There are many general introductions to UNIX available on the web (see
below). The basic commands shown here are somewhat tailored to use on the designated machines in the designated labs; they should be sufficient for the course assignments.
When you log in to UNIX (after providing your login name and password), you may be asked for a terminal type. Type
xterm
at the terminal type, or, if you see
[xterm]
there, press Return. You should now see a UNIX prompt, which usually looks like
machine_name%.
Note: The default shell (roughly, the command interpreter, or the program that takes the commands you type in and figures out what to do with them) for older users is called "csh", but you may find it easier to use other shells, like "tcsh", that have some nice features. (See section
below.) If you want to try a different shell, just type the name of it in at the prompt: typing
tcsh
will run that shell, which has a
>
prompt.
These should be typed at the prompt; after typing the command, press Return.
NAME/DESCRIPTION |
COMMAND |
COMMENTS |
copy |
cp file directory |
use "." for current directory
use ".." for parent directory
use slashes for dir. hierarchies
ex: cp myfile ../sisterdir/childdir
|
remove |
rm file(s)
rm -r directory |
ex: rm file1 dir1/file2 ../dir2/file3
for recursive removing:
unalias rm;
rm -rf dir1
|
view file |
less file |
hit the spacebar to get to next page, 'b' to go back
ex: more ReadMe; more ../ReadMe |
view directory contents |
ls; ls dir |
ls views current directory;
see "man ls" for ls options
|
change directory |
cd dir
cd |
ex: cd NoNPunctate; cd .. (move to parent directory)
cd (by itself) (move to home directory) |
print working directory |
pwd |
tells you where you currently are |
print |
lpr -Pprinter file(s) |
ex for Soda: lpr -Plw274 file1 file2
(printer in room 274) |
change password |
ssh po; (login again)
passwd
| you will be asked to state old and new passwords |
logout |
logout; exit
|
|
help |
man; man command
apropos subject |
provides some manual information about the command
lists commands with manual pages that make reference to this subject |
cancel/quit application |
Control-C |
press control and C at the same time |
list current jobs |
jobs |
This will give you a list of jobs (preceded by a
number in brackets), which may come in handy if you want to kill one
of them... |
kill a job |
kill %# |
Replace the # with the job number listed with the job
command. |
simple editor (pico) |
pico file |
easy to use, commands on the screen
see "man pico" (or vi, or emacs) for further help |
mail |
pine |
|
netscape |
netscape & |
The & symbol at the end causes the window to be
run in the background. |
new window |
xterm & |
|
You can also get a menu of options by pressing the right or middle mouse key (in the Soda lab).
Enter tcsh by typing
tcsh
at the prompt.
Note: To permanently change your shell to tcsh, so that upon logging in you will automatically be using tcsh, you can run
chsh
. You'll be asked to enter a new shell:
Old shell: /bin/csh
New shell: /usr/local/bin/tcsh
It may take a day or so for the change to take effect.
- [tab]: Complete word. When typing a file (or command) name, for
instance, you can type the first several characters and hit [tab] to
complete the word. If more than one possible completion exists, you can
type ^D to list the current possible completions.
- ^P, [up-arrow]: Copy previous command into current line. Can be used
multiple times to go progressively further back into command-line
history.
- ^N, [down-arrow]: Move forward (more recent) in command-line history.
- ^A: Move cursor to beginning of line.
- ^E: Move cursor to end of line.
- ^F, [right-arrow]: Move cursor forward/to the right.
- ^B, [right-arrow]: Move cursor backward/to the left.
- ^D: Delete current character.
- ^K: Delete rest of line.
Some more information on the tcsh shell can be found
here and
here.
Some other basic resources on the web:
... many other findable by searching on "unix basics"...