- When you log in, UNIX starts a command interpreter for you, usually called
a shell.
- The shell is what prints the command prompt and reads what you type.
- We will cover the simplest commands now and cover more versatile ones as the tutorial progresses.
- The simplest form of issuing a command is one command followed by any arguments it needs on a single line.
- UNIX gives a few ways to correct typing mistakes:
- Backspace character will erase the character before the cursor
- Control-U (hold down the key marked Control or Ctl and press W at the same time) will erase the whole line back to the command prompt
- You can erase a word at a time and, depending which shell you use, other much more powerful editing may be available but that will be covered later in the sections about the specific shells.
- What keys perform the editing functions is configurable, check with your Systems Administrator if the above doesn't work.
- Most common difference is having the Delete character for erasing characters
- The list of UNIX commands is long. We will cover them slowly through the rest of the tutorial.
- Most commands take flags to alter the way they work.
- Flags usually begin with a dash ("-").
- One or more characters immediately follows the dash.
- Usually each character affects the command being run.
- Each command will have its own set of flags it understands.
- In many cases, a given flag (e.g. the f flag) will have
roughly the same meaning for different commands.
- You can get the ls command to divulge more information about each file by issuing the l flag:
% ls
% cp /etc/motd .
% ls
motd
% ls -l
total 2
-rw------- 1 kns 1203 Mar 3 13:12 motd
%
- We will cover what that means later.
- By tradition, UNIX utilities precede their configuration file names with
a "." character. By default, ls does not show files whose names begin with ".".
- The a flag tells ls to list these files:
% ls
motd
% ls -a
. .Xauthority .cshrc .netscape .twmrc .xsession
.. .Xdefaults .login .newsrc .xinitrc motd
%
- Note "." and ".." directories.
- Most commands use "--" (two consecutive dashes) to indicate the end of the flags if for some reason you need to have a command argument begin with a dash.
- For example, suppose you managed to create a file named "-t"
- if you type the command rm -t the rm command thinks the -t is a flag, not a filename
- To illustrate:
% ls
-t motd
% rm -t
rm: illegal option -- t
usage: rm [-fiRr] file ...
% ls
-t motd
% rm -- -t
% ls
motd
%