Basic Unix commands and Sun use info
Definitions
- A path or fully qualified path is the prefix to a
filename. Say, for instance, that I want to list the contents of a
directory in my home directory called
cheese, I type:
ls cheese/. A directory inside cheese/ would
be cheese/green/. If I wanted to specify a directory from
the top of the filesystem directory tree, I put a leading / on the
directory to make it a fully qualified path like so: ls
/usr/local/bin/ .
- A shell is the interactive command line interpreter to
Unix. Typically you will have a prompt that looks like
% or ~%. Usually you will see it in an
xterm, which looks like a small terminal window.
Shell commands
man command: displays the Unix man pages for
command. Of course, these pages are meant for people who
already know Unix, so you will probably find them unreadable at
first...still, it's how everyone has to start. The man pages are also
available on a web
page. There is also tutorial-style
Unix Help, which is slightly more novice-friendly.
ls, ls -a, ls -l, ls -la, etc. : lists the files in
your current working directory for that shell. Try each alternative
to see what they do. Read the man
page for more information.
- cd directory : changes the current working directory to
directory where directory may be a path or a fully
qualified path (q.v.). A ~ indicates your home directory. ~bob
indicates the home directory of bob. Read the man
page for more information.
rm filename : removes the file
filename, where filename may be the name of a file, a
path, or a fully qualified path. Read the man
page for more information.
cp source destination : copies the file
source to the file destination where source and
destination may be file names, paths, or fully qualified
paths. Read the man
page for more information.
mv source destination : the same as cp,
but it moves the source file instead of copying it - after the
operation source will no longer exist. Read the man
page for more information.
chmod mode filename : changes the permissions
for letting yourself and other people access your files. Read the man
page for more information.
Basic Utilities
- Printing: the lpr command is the basic printing command. In
your shell, type:
lpr -Pprintername filename to
print the file filename to the printer specified in
printername. If you omit -Pprintername, lpr will
print to your default printer which is the asprey lab printer. The
intro lab printer is comsc1. There is no space between the -P
and printername, for example lpr -Pcomsc1
proj1.C
- File compression:
gzip filename will compress
the file filename and give it the .gz name
extension. gzip -d filename.gz or gunzip
filename.gz will decompress the file and remove the .gz
extension.
- Email: Email can get very complicated, but the most common problem
people run into is trying to mail a file to a professor. this is
easily accomplished from your shell by typing:
mail
ProfEmailAddress < filename
- Vax mail: you can get your mail at the vax by typing:
telnet
vaxsar in an xterm shell.
Where to go from here
Help on any Unix command or system call can be found in the man
pages. There are two very useful books in the co-op bookstore on
Unix. See the sign on the window side of the asprey lab. if you need
help with emacs, pick up an emacs command reference page from the
folder above the terminal next to the asprey printer, or visit the emacs info
web page. If you are still having trouble, email or find priestdo
(Greg).