Shell commands


Show this command by itself; introduces filenames and directories.


Then show it with filenames as arguments, which is not a lot of use in itself, but preparatory for the next one.

*.c or whatever suits your example directory

Then wildcards, thus introducing wildcard expansion. Explain that this is done by the shell, not by ls itself, which is behaving just as it did when you gave it individual filenames.


Introduce the idea of options, and the usual syntax and mnemonic value of them. Introduce the idea of file ownership and permissions; perhaps a brief mention of execute permissions. (Probably gloss over groups at this stage.) With options like this, giving individual filenames becomes useful again.


Introduce . and .., and the hierachical directory structure. Then show listing of absolute pathnames, such as ls /etc/


More about the hierarchical directory structure.


Explain that this is useful for feeding the output into other programs.

-tl, -rtl

Explain about the file timestamps.

cd, pwd

Introduce the idea of the working directory.


Introduce the | syntax.


Another thing to use in pipes


Introduce the idea of storing data in a line-based file


Ignore case -- often useful


Locate which files a string occurs in.


Give the line numbers


Negative output


Another useful pipeline element.

This is a good stage at which to introduce redirection of input/output from/to files.


Makes a set from a collection

+2 etc

Sorts by different columns

echo almost anything

A built-in command -- explain the difference between this and commands that run programs. Explain why cd must also be a built-in command.


Re-iterate that it is the shell that expands wildcards, not programs such as ls.


Introduce the idea of environment variables, explaining that some of them, such as PATH, are used by the system, but you can also make your own.

which ls and other program names

Explain that, like the shell itself, this searches the path.


Introduce the shell backquote syntax, first using echo `which ls` to demonstrate it, and then putting it to real use with ls -l `which ls`.

[Operating Systems] To me Last modified: Thu Nov 24 12:24:48 GMT 2005