Back
The ls command lists all files in the directory that match the name. If name is left blank, it will list all of the files in the directory.
The syntax for the ls command is:
* ls [options] [names]
Option Description
-a Displays all files.
-b Displays non-printing characters in octal.
-c Displays files by file time-stamp.
-C Displays files in a columnar format (default)
-d Displays only directories.
-f Interprets each name as a directory, not a file.
-F Flags file-names.
-g Displays the long format listing, but exclude the owner name.
-i Displays the i-node for each file.
-l Displays the long format listing.
-L Displays the file or directory referenced by a symbolic link.
-m Displays the names as a comma-separated list.
-n Displays the long format listing, with GID and UID numbers.
-o Displays the long format listing, but excludes group name.
-p Displays directories with /
-q Displays all non-printing characters as ?
-r Displays files in reverse order.
-R Displays sub-directories as well.
-t Displays newest files first. (based on time-stamp)
-u Displays files by the file access time.
-x Displays files as rows across the screen.
-1 Displays each entry on a line.
Examples
$ ls -l /etc
-rw-r--r-- 1 root root 15276 Oct 5 2004 a2ps.cfg
-rw-r--r-- 1 root root 2562 Oct 5 2004 a2ps-site.cfg
drwxr-xr-x 4 root root 4096 Feb 2 2007 acpi
-rw-r--r-- 1 root root 48 Feb 8 2008 adjtime
drwxr-xr-x 4 root root 4096 Feb 2 2007 alchemist
$ ls -ld /etc
drwxr-xr-x 21 root root 4096 Jun 15 07:02 /etc
* Please note that there are many flavors of Linux, so if in doubt, consult your man pages.
The ls command lists all files in the directory that match the name. If name is left blank, it will list all of the files in the directory.
The syntax for the ls command is:
* ls [options] [names]
Option Description
-a Displays all files.
-b Displays non-printing characters in octal.
-c Displays files by file time-stamp.
-C Displays files in a columnar format (default)
-d Displays only directories.
-f Interprets each name as a directory, not a file.
-F Flags file-names.
-g Displays the long format listing, but exclude the owner name.
-i Displays the i-node for each file.
-l Displays the long format listing.
-L Displays the file or directory referenced by a symbolic link.
-m Displays the names as a comma-separated list.
-n Displays the long format listing, with GID and UID numbers.
-o Displays the long format listing, but excludes group name.
-p Displays directories with /
-q Displays all non-printing characters as ?
-r Displays files in reverse order.
-R Displays sub-directories as well.
-t Displays newest files first. (based on time-stamp)
-u Displays files by the file access time.
-x Displays files as rows across the screen.
-1 Displays each entry on a line.
Examples
$ ls -l /etc
-rw-r--r-- 1 root root 15276 Oct 5 2004 a2ps.cfg
-rw-r--r-- 1 root root 2562 Oct 5 2004 a2ps-site.cfg
drwxr-xr-x 4 root root 4096 Feb 2 2007 acpi
-rw-r--r-- 1 root root 48 Feb 8 2008 adjtime
drwxr-xr-x 4 root root 4096 Feb 2 2007 alchemist
$ ls -ld /etc
drwxr-xr-x 21 root root 4096 Jun 15 07:02 /etc
* Please note that there are many flavors of Linux, so if in doubt, consult your man pages.