Now that you know that files and directories exist, there must be some way of manipulating them. Indeed there is. The command ls is one of the more important ones. It li sts files. If you try ls as a command, you'll see:
That's right, you'll see nothing. Unix is intensionally terse: it gives you nothing, not even ``no files'' if there aren't any files. Thus, the lack of output was ls's way of saying it didn't find any files.
But I just said there could be 8000 or more files lying around: where are they? You've run into the concept of a ``current'' directory. You can see in your prompt that your current directory is /home/larry, where you don't have any files. If you want a list of files of a more active directory, try the root directory:
In the above command, ``ls /'', the directory is a parameter. The first word of the command is the command name, and anything after it is a parameter. Some commands have special parameters called options or switches. To see this, try:
The -F is an option that lets you see which ones are directories, which ones are special files, which are programs, and which are normal files. Anything with a slash is a directory. We'll talk more about ls's features later. It's a surprisingly complex program!
Now, there are two lessons to be learned here. First, you should learn
what ls does. Try a few other directories that are shown in
Figure , and see what they contain. Naturally,
some will be empty, and some will have many, many files in them. I
suggest you try ls both with and without the -F option.
For example, ls /usr/local looks like:
The second lesson is more general. Many Unix commands are like ls. They have options, which are generally one character after a dash, and they have parameters. Occasionally, the line between the two isn't so clear.
Unlike ls, some commands require certain parameters and/or options. To show what commands generally look like, we'll use the following form:
ls [-arF] [directory]
That's a command template and you'll see it whenever a new command is introduced. Anything contained in brackets (``['' and ``]'') is optional: it doesn't have to be there. Anything slanted should usually be changed before trying the command. You'll rarely have a directory named directory.