Name
ls [options
] [files
] — coreutils
Synopsis
/bin
stdin stdout - file -- opt --help --version
The ls
command (pronounced as it is spelled, ell ess) lists attributes of files and directories. You can list files in the current directory:
$ ls
in given directories:
$ ls dir1 dir2 dir3
or individually:
$ ls file1 file2 file3
The most important options are -a
and -l
. By default, ls
hides files whose names begin with a dot; the -a
option displays all files. The -l
option produces a long listing:
-rw-r--r-- 1 smith users 149 Oct 28 2002 my.data
that includes, from left to right: the file’s permissions (-rw-r--r--), owner (smith), group (users), size (149 bytes), last modification date (Oct 28 2002) and name. See File Protections for more information on permissions.
Useful options | |
| List all files, including those whose names begin with a dot. |
| Long listing, including file attributes. Add the |
| Decorate certain filenames with meaningful symbols, indicating their types. Appends “/” to directories, “*” to executables, “@” to symbolic links, “|” to named pipes, and “=” to sockets. These are just visual indicators for you, not part of the filenames! |
| Prepend the inode numbers of the files. |
| Prepend the size of the file in blocks, useful for sorting files by their size: $ ls -s | sort -n |
| If listing a directory, list its contents recursively. |
| If listing a directory, do not list its contents, just the ... |
Get Linux Pocket Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.