A directory is a file containing information about other files and directories. A directory which is found "within" another directory is called a "subdirectory" and can contain even more subdirectories. A Unix file system is like a tree with a root (the "/" directory) and many branches (subdirectories).
When an account is created for you, you are assigned a "home directory". This is where you will find yourself every time you log in. If you were to type "pwd" (print working directory) after you logged in, you would see something like this:
The names are sorted into alphabetical order automatically, but other variations are possible. For example, the command "ls -t" causes the files to be listed in the order in which they were last changed, most recent first.
The "-l" option (that's the letter l, not the number 1) gives a long listing. "ls -l" will produce something like:
Options can be combined: "ls -lt" gives the same thing as "ls -l", but sorted into time order (i.e., the most recently modified files are listed first). You can also name the files you're interested in, and "ls" will list the information about only them.
The use of optional arguments that begin with a minus sign, like "-t" and "-lt", is a common convention for Unix programs. In general, if a program accepts such optional arguments, they precede any filename arguments. It is also vital that you separate the various arguments with spaces: "ls-l" is not the same as "ls -l".
The "ls" command doesn't normally list files whose names begin with a dot (or period), such as '.login' and '.cshrc'. If you want these files listed, include the "-a" option, as in "ls -a".
So far we have used filenames without ever saying what's a legal name, so it's time for a couple rules. First, filenames are limited to 255 characters, which is enough to be descriptive. Second, although you can use almost any character in a filename, common sense says you should stick to ones that are visible, and that you should probably avoid characters that might be used with other meanings. We have already seen, for example, that in the "ls" command, "ls -t" means to list in time order. So if you had a file whose name was "-t", you would have a tough time listing it by name. Besides the minus sign, there are other characters which have special meaning. To avoid pitfalls, you would do well to use only letters, numbers and the period until you're familiar with the situation. Note that there is a difference between upper- and lower-case letters in filenames. In this document, all filenames will be in lower-case.
There are special files, usually in your home directory, whose names start with a period (.). These files are not listed when you use the "ls" command unless you use the "-a" option. Filenames which begin with a comma (,) are removed automatically every night. Files beginning and ending with a sharp sign (#) are created by the GNU Emacs editor as temporary files and are deleted after three days.