A Quick Introduction to Unix/Listing Files and Directories

Listing files and directories
ls (list)

When you log in, you are in your home directory. This directory is associated with your userid, for example, ccaajim, and it is where your personal files and subdirectories are stored.

To find out what is in a directory you can type

% ls

The ls command lists the contents of your current working directory.



Some files will usually have been created by the System Administrator when your account was created. If no files are visible in your home directory, you will simply return to the Unix prompt.

ls lists only those files whose name does not begin with a dot (.) Files beginning with a dot are hidden files and usually contain program configuration information. They are hidden because they are typically generated by other programs and not directly edited by users.

To list all the files in your home directory, including those whose names begin with a dot, type % ls -a



The -a in the command is an example of an option. Options change the behaviour of commands. Test the output of ls -l and of ls -la.

Another useful option is -t which displays the directory contents newest first by timestamp.