Examples of using command arguments

To use a command with no argument:


Entered on its own this command displays the current time and date.

To use a command with a single argument:

   cd newdir

The cd command (used to change from one directory to another) takes the name of the directory newdir as its argument.

To use a command with several arguments:

   cat file1 file2 file3

The cat command takes the names of three files as arguments. It prints file1 followed by file2 and then file3 on the screen. This explains the name of the command - it concatenates any files given to it as arguments.

To 'quote' an argument:

   ls 'part 1'

This lists information about the file part 1. The quotation marks ensure that the shell interprets the command line as the ls command followed by a single argument 'part 1'.

If the quotation marks were left out, the shell would interpret the command line as an instruction to list information about the file part and then the file 1.

[Home] [Search] [Index]