Up: Karel's home page
Help with UNIX Commands
This page deals with the basics of using the command line in UNIX to do
simple things. Here is a list of
common Unix commands
There is a web page at Rutgers that answers FAQs (Frequently
Asked Questions) about UNIX and the SUN workstations at Rutgers-Camden:
FAQ HELP link. There is
also information on Unix at
New Mexico Tech.
Getting Started
If you have the lush menu in front of you, in order to get
access to the UNIX command line, you can issue the command shell.
It should be enough to type just the s or sh before you
hit RETURN. When you want to return to the lush menu,
type exit (that is, exit from the shell).
The Most Basic Commands
At first you will be working in your home directory, so
that will be your
present working directory at the start. We will bring in
commands and information about creating directories later.
Here is a short list of the most basic commands in UNIX.
Each is typed at the prompt and followed by pressing the
RETURN key.
Useful Tricks
One of the most useful tricks in the UNIX shell that is used at
Rutgers-Camden is using TAB to complete a partial command or filename.
If you have a file with the name
"I-am-getting-tired-of-typing",
and you want to open it in the emacs editor, then, at the prompt
you type emacs followed by a space and then you type the
first few letters of the filename, say I-am and then press
the TAB key.
You must type enough characters so that there are no other files in the
present working directory with names that start with the characters
that you typed.
After you have typed the command, or typed part of the command and
used TAB-completion to get the shell to complete your command, you
press the RETURN KEY to pass your command to the shell.
Another useful trick is to keep your working shell useable by typing
emacs I-am [press TAB KEY] & [hit RETURN KEY] The
& (=ampersand) makes UNIX
run emacs in the background, which leaves the command
line useable
in your working shell. The line should look like this before you
hit return:
prompt% emacs I-am-getting-tired-of-typing &
except that instead of the word prompt you will have
something associated with the machine or server that you are using.
Working with Directories and Paths
Something to Know About Directories and Paths
Computers typically organize files by putting them into containers that
are called directories or folders.
Each container can have other containers inside it.
To keep track of what's what, the computer's operating system software uses
a tree structure in which the nodes correspond to containers. To specify
a container, you have to specify the sequence of edges that you would traverse
in going from the root to the node that is associated with the container you
want, or, what is the same, you can specify the sequence of nodes between the
root and the container's node. That sequence of nodes is called the
path that
specifies the container. The path is written something like this:
top/high/lower/
still_lower/and_so_on, since trees are written upside down in math and
computer
science. Above any given node, there is just one node, and in UNIX,
it is called
the parent directory. And one last bit of information: the
directory where you are currently working is called, reasonably,
"the Present Working Directory".
Working with Emacs, LaTeX and Document Viewers
If you have a LaTeX source file, say small2e.tex, then you
can process it by giving the command
"latex small2e".
LaTeX will produce a log file that indicates some details of
how the file was processed and any errors that need attention. If
the process stops, just look carefully at the error indication, type
"x"
and correct the error in the source file. If the processing does not
run into errors, then LaTeX will produce a DVI (that is, DeVice
Independent) file, say small2e.dvi.
To view small2e.dvi, give the command
"xdvi small2e".
To print small2e.dvi to your default printer, give the command
"dvips small2e",
or if you want to print on a different printer, say
printer xxxx, then give the command
dvips small2e -Pxxxx.
Here is a brief reminder of the commands that you can use to
compose, process, view, and print when you are working on a
LaTeX document:
emacs somefilename.tex &
latex somefilename (The extension
.tex can be omitted (a handy feature))
xdvi somefilename or xdvi !$ or
even, if you have already given the command in your current
session, !xd
- -- Go back to the (still open)
emacs window
to correct errors, or, if there are no errors, skip to step 6
to print your DVI file.
- -- Return to step 2.
-
dvips somefilename --print to your default printer,
--or--go to step 7
-
dvips somefilename -Pxxxx (where
-Pxxxx
specifies the name xxxx of the printer that you want
to use)
A little trick to make it quicker to do repetitive tasks: press
the up arrow key to retrieve the previous command, or press it
twice to retrieve the command before that, and so on. This makes
use of the history list maintained by the Unix operating system,
which tracks the commands (with their arguments) that you have
used during the current session.
The following will include some information arranged alphabetically by topic.
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
- Access to my home directory?
- Use the name
~/ to refer to your home directory
- Access to the parent directory?
- Use the name
../ to refer to the parent
of the present working directory
-
-