next up previous contents
Next: Wild-cards and file name Up: Files and directories Previous: Viewing the contents of   Contents


Listing files and directories

The command ls will list the names of files and directories in your current directory. There are several options in this command. Commonly used ones are as follows.
  1. ls -l will provide a long listing of the contents of the current directory. This listing includes the file type, permissions, owner and group associated with the file, the time of last modification, size of the file and the file name.
  2. ls -l -h same as above except the size is shown in human readable units like KB, MB, GB etc.
  3. ls -F will mark all files that are executable with a star (*) and all directories with a slash (/).
  4. ls -color will show a colored listing of files. The default is to show directories in blue, executables in green. See section 4.5.5 for more details. This is the default on Linux.
  5. ls -t will list files in time order, most recent first.
  6. ls -a will show all files in the current directory, including the special ``dot'' files.

Use ls --help | less to see the other options of the ls command.


next up previous contents
Next: Wild-cards and file name Up: Files and directories Previous: Viewing the contents of   Contents
Amit Jain 2009-08-23