Examples of commands

To enter a simple command:

   ls

This command lists the contents of the current directory. In this example, no options or arguments are used.


To enter a command together with one of its options:

   ls -l

The -l option changes the way the ls command works. This command produces a listing of the contents of the current directory in a long format.


To enter a command together with several options and an argument:

   lpr -Pps5 -#3 -m foo.c

The option -Pps5 specifies that the file foo.c is to be printed on printer ps5. The option -#3 specifies that 3 copies of the file are to be printed. The option -m requests that a mail message is sent to the user once the command has been completed.


To enter a command with several arguments:

   lp part1 part2 part3

This will print the files part1, part2 and part3 on the default printer.


To enter a command using a regular expression as an argument:

   rm -i [pP]*.ps

This will prompt the user if they want to remove any file whose name matches the regular expression [pP]*.ps. This will remove a file with the name part1.ps and the file Personnel.ps.


[Home] [Search] [Index] This site maintained by webmaster@cs.auckland.ac.nz