Prints the contents of the directory.
ls [options] [directory-names]
-a displays all files, including those with names starting with a dot (.).
-b displays unprintable characters in file names in octal.
-c sort the files by the time of their creation.
-d displays directories as well as regular files (not display their contents).
-f displays the contents of directory without sorting (just as it is stored on disk).
-i displays information about the inode “inode”.
-l displays a list of files in a long format with detailed information.
-p adds the file name symbol showing its type.
-r sorts the contents in reverse alphabetical order.
-s displays next to the names of files to the size (in kilobytes).
-t sorts the contents on the timestamp files.
-1 Displays a list of file names in one column.
-R Recursively display the files in all subdirectories.
The ls command displays the contents of the specified directory. If the directory name is omitted, ls displays contents of current directory. By default, ls does not display files with names which begin with a dot (.) to see all the files, type ls -a. Detailed information about the files (including size, ownership and group ownership and right to read – Recording – performance) can be obtained using the command ls -l.
A common combination is ls -al; it shows a long list of files and their properties as well as the destinations that any symbolic links point to. ls -latr displays the same files, only now in reversed order of the last change, so that the file changed most recently occurs at the bottom of the list.
ls Albums/ Radio/ Singles/ gene/ index.html ls -a ./ .thumbs Radio gene/ ../ Albums/ Singles/ index.html ls -l Radio/ total 8 drwxr-xr-x 2 user user 4096 Oct 30 1999 Carolina/ drwxr-xr-x 2 user user 4096 Sep 24 1999 Slashdot/ ls -ld Radio/ drwxr-xr-x 4 user user 4096 Oct 30 1999 Radio/ ls -ltr total 20 drwxr-xr-x 4 user user 4096 Oct 30 1999 Radio/ -rw-r--r-- 1 user user 453 Jan 7 2001 index.html drwxrwxr-x 30 user user 4096 Oct 20 17:32 Singles/ drwxr-xr-x 2 user user 4096 Dec 4 23:22 gene/ drwxrwxr-x 13 user user 4096 Dec 21 11:40 Albums/
On most Linux versions ls is aliased to color-ls by default. This feature allows to see the file type without using any options to ls. To achieve this, every file type has its own color. The standard scheme is in /etc/DIR_COLORS:
blue – directories
red – compressed archives
white – text files
pink – images
cyan – links
yellow – devices
green – executables
flashing red – broken links
in that “lrt” stands for??