Examples of commands

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 unixhelp@math.rutgers.edu
This page was last updated on September 05, 2006 at 10:29 am and is maintained by webmaster@math.rutgers.edu.
For questions regarding courses and/or special permission, please contact mclausen@math.rutgers.edu.
For questions or comments about this site, please contact help@math.rutgers.edu.
© 2012 Rutgers, The State University of New Jersey. All rights reserved.