[Next] [Up] [Previous] [Contents]
Next: Catenate (cat) Up: Basic commands Previous: Getting out (exit)

Listing files (ls)

The names of files and subdirectories can be displayed with the ls (list) command. Typing ls lists the files and subdirectories located in the working directory that don't begin with a ``.''. To see all the names, use the all flag, i.e. ls -a.

Other interesting flags for the ls command are:


    -F      Marks directories with a trailing slash and executable files with 
            a trailing asterisk.
    -l      Lists in long format.  Gives all sorts of information.
    -R      Recursively lists subdirectories encountered.
    -s      Gives the size of each file.
    -t      Sorts by time modified instead of by name.
It is possible to limit the scope of the files and subdirectories by using the wildcard characters discussed in section [*]. For example, I would type


    ls q*
if I wanted to list all the files and subdirectories that began with a q.

Note that the ls command lists files in the working directory only, unless you include the pathname to another directory whose filenames you want to list.


c.c.taylor@ieee.org