Glossary

ls

ls is the command for listing the contents of a directory. Without arguments it shows the current directory; given one or more paths, it shows each in turn. It is almost certainly the first command every Linux user learns.

ls                       # names in the current directory
ls -l                    # long form: permissions, owner, size, mtime
ls -la                   # long form, including hidden files (those starting with '.')
ls -lh                   # human-readable sizes (K, M, G)
ls -lt                   # sort by modification time, newest first
ls -ltr                  # oldest first (reverse sort)
ls -R /etc               # recurse into subdirectories

On most distributions ls is an alias for ls --color=auto, which colours entries by file type. The underlying binary lives in /bin/ls and comes from the GNU coreutils package.

Related terms: cd, pwd, stat, coreutils

Discussed in:

Textbook of Linux — Learn Linux on iPhone — Download on the App Store