Previous Section  < Day Day Up >  Next Section

ls—lists contents of directory


ls [ –abcCdfFgilLmnopqrRstux1 ] [ names ]


For each directory argument, ls lists the contents of the directory; for each file argument, ls repeats its name and any other information requested. The output is sorted alphabetically by default. When no argument is given, the current directory is listed.

Example A.37.

1   ls -alF

2   ls -d a*

3   ls -i


EXPLANATION

  1. The –a lists invisible files (those files beginning with a dot), the –l is a long listing showing attributes of the file, the –F puts a slash at the end of directory filenames, an * at the end of executable script names, and an @ symbol at the end of symbolically linked files.

  2. If the argument to the –d switch is a directory, only the name of the directory is displayed, not its contents.

  3. The –i switch causes each filename to be preceded by its inode number.

    Previous Section  < Day Day Up >  Next Section