Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

NAME

ls - list directory contents

SYNOPSIS

ls [OPTION...] [FILE...]

DESCRIPTION

List information about the FILEs (the current directory by default).

OPTIONS

-a
List all files, including system and hidden.

-d
List directory entries instead of contents.

-h
Print file sizes in human-readable format.

-l
Use a long listing format.

-S
Sort by file size.

-1
(digit one) List one file per line.

EXAMPLES

Display One File Per Line Using ls -1

Code Block
ls -1

Display All Information About Files/Directories Using ls -l

Code Block
ls -l

 Display hidden files using -a option:

Code Block
ls -a

 Display directory entries instead of contents, use the -d option

Code Block
ls -d

 To display information of specific files

Code Block
ls foo1.sql foo2.sql foo3.sql

 To redirect the output of ls to a file in the current directory, use the command:

Code Block
ls /etc >>listing.txt

SEE ALSO

cd
pwd