Entering commands

  • To enter a command type its name followed by any options and arguments that you want the command to have. Leave one or more spaces between the command name, its options and arguments.

  • Correct mistakes by using the Delete or BackSpace key to back up along the command line and correct it or delete the whole line by holding down the control key and pressing u

  • A command can be continued onto another line by entering a backslash (\) and pressing Return.

  • To enter several commands on the one command line, use a ; (semicolon) to separate each one from the next. For example:

    cd ..; ls -l

    This command line contains two commands. The first, cd .. changes the current directory to the parent directory. The second, ls -l produces a long listing of the contents of the current directory.

  • Previously issued commands can be reused via the history command.

Filename completion

To turn on filename completion set the shell variable filec:

   set filec

Then to complete a file or directory name press the ESC key.

   ls -l on<ESC>line_help

If the filename is not completed enter more characters until the filename can be uniquely identified.

Matching file names with regular expressions

You can use the following metacharacters to create regular expressions that match file names.

   ?       matches any single character
   *       matches any number of any characters
   [nnn]   matches any of the enclosed characters
   [!nnn]  matches any character that is not enclosed
   [n-n]   matches any character in this range

To list all files with a particular extension:

   ls *.fm

This will list all the files in the current directory that have the extension .fm.

To remove a range of files:

   rm prog.?

This removes all the files in the current directory with a single character extension to their name. Files foo.c and foo.o would be removed as would file foo.3.

To copy all the files containing the same pattern:

   cp [pP]art[0-9] ../book

This copies all files whose name contains a pattern that starts with either p or P followed by the letters art and ending in any number from 0 through to 9.

So the file part1 would be copied to the parent directory book as would the file Part7.