Unix is an operating system that controls the computer and your interaction with it. The shell lets you communicate with Unix by providing you with the system prompt. When you see a system prompt, it means the shell is ready for a command. Once you enter a command, the shell interprets it and is responsible for its execution. Up until now, each time you have entered a command, you have been using the shell. The shell also controls your environment and contains a programming language.
Most Unix computers, including Uniform Access computers, run several shells, allowing you to choose the one you prefer. By default, on Uniform Access computers, you start in the C-shell.
| <Control>d | Signals the end of a file you are entering from the terminal if typed at the beginning of a line or if typed twice elsewhere in a line. | ||
| <Control>c | Cancels a command or interrupts a running program. | ||
| <Control>z | Suspends a process or job but does not terminate it: use fg to restart suspended process or job. | ||
| <Control>u | Clears the command line. |
To redirect a file as input for a command, enter:
command < file
To redirect command output to a file, enter:
command > file
Note: If you specify a file that already exists, its contents will be overwritten.
|
You can use output redirect to save information such as a help note into a
file.
To save the email help note as a file, enter: help email > email.info This creates the file named email.info and places the text from the email help note into this file, rather than displaying it on the screen. |
To append command output to an existing file, enter:
command >> file
To chain two commands, enter:
command1 | command2
|
The w command displays a list of who is on the system.
This list is usually very long, and it scrolls by quickly. to view the
output of the w command one screen at a time, you can
link it to the more program.
To show who is on the system one screen at a time, enter: w | more For additional information about more see View a File. |
ps ux
Any of your processes can be stopped with the kill command.
To kill a process, enter:
kill pid
Where pid is the number of the process you want to stop. Type ps again to verify that the process has been killed. Some processes require a stronger form of the kill command. When the kill command alone does not terminate a process, try using the kill command with the -9 option.
To kill a process using the -9 option, enter:
kill -9 pid
To start a process in the background type an & after the command. Enter:
command &
This starts the process, from the command you specify, in the background.
To suspend a foreground process and place it in the background, use the following steps:
To bring this background process to the foreground again, enter:
fg
Note: the fg command is useful to remember because occasionally you might type <Control>z accidentally or, if you connect with a modem, noise in the phone lines might magically suspend a process. Just enter fg to restart such a suspended process.