ls

List information about FILEs, by default the current directory.

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

KEY
      Sort entries alphabetically if none of -cftuSUX nor --sort.

  -a, --all                  Do not hide entries starting with .

  -A, --almost-all           Do not list implied . and ..

  -b, --escape               Print octal escapes for nongraphic characters

      --block-size=SIZE      Use SIZE-byte blocks

  -B, --ignore-backups       Do not list implied entries ending with ~

  -c                         Sort by change time; with -l: show ctime

  -C                         List entries by columns

      --color[=WHEN]         Control whether color is used to distinguish file
                             types. WHEN may be `never', `always', or `auto'

  -d, --directory            List directory entries instead of contents

  -D, --dired                Generate output designed for Emacs' dired mode

  -f                         Do not sort, enable -aU, disable -lst

  -F, --classify             Append indicator (one of */=@|) to entries

      --format=WORD          Across -x, commas -m, horizontal -x, long -l,
                             single-column -1, verbose -l, vertical -C

      --full-time            List both full date and full time

  -g                         (ignored)

  -G, --no-group             Inhibit display of group information

  -h, --human-readable       Print sizes in human readable format (e.g., 1K 234M 2G)
  -H, --si                   Likewise, but use powers of 1000 not 1024

      --indicator-style=WORD Append indicator with style WORD to entry names:
                             none (default), classify (-F), file-type (-p)

  -i, --inode                Print index number of each file

  -I, --ignore=PATTERN       Do not list implied entries matching shell PATTERN

  -k, --kilobytes            Like --block-size=1024

  -l                         Use a long listing format

  -L, --dereference          List entries pointed to by symbolic links

  -m                         Fill width with a comma separated list of entries

  -n, --numeric-uid-gid      List numeric UIDs and GIDs instead of names

  -N, --literal              Print raw entry names (don't treat e.g. control
                             characters specially)

  -o                         Use long listing format without group info

  -p, --file-type            Append indicator (one of /=@|) to entries

  -q, --hide-control-chars   Print ? instead of non graphic characters

      --show-control-chars   Show non graphic characters as-is (default)

  -Q, --quote-name           Enclose entry names in double quotes
      --quoting-style=WORD   Use quoting style WORD for entry names:
                             literal, shell, shell-always, c, escape

  -r, --reverse              Reverse order while sorting

  -R, --recursive            List subdirectories recursively

  -s, --size                 Print size of each file, in blocks

  -S                         Sort by file size

      --sort=WORD            time -t, version -v, status -c 
                             size -S, extension -X, none -U
                             atime -u, access -u, use -u
                             
      --time=WORD            Show time as WORD instead of modification time:
                               atime, access, use, ctime or status; 
                               also use this as a sort key if --sort=time

  -t                         sort by modification time

  -T, --tabsize=COLS         assume tab stops at each COLS instead of 8

  -u                         sort by last access time; with -l: show atime

  -U                         do not sort; list entries in directory order

  -v                         sort by version

  -w, --width=COLS           assume screen width instead of current value

  -x                         list entries by lines instead of by columns

  -X                         sort alphabetically by entry extension

  -1                         list one file per line

      --help                 display help and exit

      --version              output version information and exit

The most common options are -a (all files) and -l (long or details)

When output to file the files are listed one per line.

By default, colour is not used to distinguish types of files. That is equivalent to using --color=none.
Using the --color option without the optional WHEN argument is equivalent to using --color=always.
With --color=auto, color codes are output only if standard output is connected to a terminal (tty).

EXAMPLES

ls -al

total 109
drwxr-xr-x  18 root     root         4096 Jun  9 21:12 ./
drwxr-xr-x  18 root     root         4096 Jun  9 21:12 ../
drwxr-xr-x   2 root     root         4096 Jun  9 21:14 bin/
drwxr-xr-x   3 root     root         1024 Jun  9 20:32 boot/
drwxr-xr-x   6 root     root        36864 Jul 12 10:26 dev/
drwxr-xr-x  34 root     root         4096 Jul 12 10:25 etc/
drwxr-xr-x   5 root     root         4096 Jun  9 21:28 home/
drwxr-xr-x   4 root     root         4096 Jun  9 21:18 lib/
drwxr-xr-x   2 root     root        16384 Jun  9 21:01 lost+found/
drwxr-xr-x   2 root     root         4096 Nov 24  1999 misc/
drwxr-xr-x   5 root     root         4096 Jun  9 20:32 mnt/
drwxr-xr-x   2 root     root         4096 Aug 23  1999 opt/
dr-xr-xr-x  63 root     root            0 Jul 12 11:25 proc/
drwx------  13 root     root         4096 Jul 12 01:00 root/
drwxr-xr-x   3 root     root         4096 Jun  9 21:22 sbin/
drwxrwxrwt   9 root     root         4096 Jul 12 13:48 tmp/
drwxr-xr-x  19 root     root         4096 Jun  9 21:07 usr/
drwxr-xr-x  17 root     root         4096 Jun  9 21:22 var/

the first column under long (-l) is the file type 
'd' for directory(folder)
'f' for file

ls * lists ALL subdirectories

Related commands:

dir - Briefly list directory contents
dircolors - Colour setup for `ls'
dirname - Convert a full pathname to just a path
quota - Display disk usage and limits
rm - Remove files
rmdir
- Remove folder(s)
wc - Print byte, word, and line counts

Equivalent Windows NT commands:

DIR
- Display a list of files and folders
You can also list files with XCOPY /L
DIRUSE - resource kit utility to show size of multiple subfolders.



Back to the Top

Simon Sheppard
SS64.com