Introductory UNIX Guide
These commands are some of the most basic and commonly used commands in UNIX. Learning these commands will allow you to get around more quickly in your new account, and also give you a good idea of some of the things you are able to do on a UNIX system. Hopefully the commands included in this document are useful to you. If there is anything you think could be added or changed to make it better, email your suggestions to the Head Consultant.
You will notice that for some of the commands you type below, your shell
will continue to run them until they are completely done. When it does
this, it will "steal" your prompt, and you will be unable to use the
shell again until the program it is running has finished execution. In
order to continue using the shell effectively (that is, to get your
prompt back so you can type in more commands), you can put any program
in the background.
To make a program run in the background, you can type an '&'
after the command you wish to run and then hit return. The prompt
should return immediately. If you would like to background an program
after it has been started, you can do so by hitting CTRL-z (also
abbreviated as C-z or ^Z) which suspends the process, and then typing
'bg' when the prompt has returned. Typing ^Z without typing
'bg' will "freeze" the program. Typing 'bg' will allow it to continue
what it is doing but not take over your shell. To bring any program you
have backgrounded back into the foreground, simply type
'fg'.
You can find out more information about most of these commands by using
the man pages. These pages give detailed information and lists
all of the different possible options that are available for most UNIX
commands. To view the man page for a specific command, simply type
'man <command>'. You can even type 'man man' for
more information about the man command itself. If you have more
questions or need some help in deciphering the man page, feel free to
ask the Sun Lab Consultant for assistance.
Check out
http://www.cs.brown.edu/system/software/support.html for an
explanation of tstaff software support. You can also figure out
which applications are supported by using the which command (see
below for full description). Any applications whose path begins with
"/usr/bin" or "/usr/local/bin" are supported, while any applications
that begin with "/cs" are not.
New students are strongly encouraged to use supported
software. Any problems which users may have with supported software
should be mailed to
software@cs.brown.edu and will be taken care of by tstaff as quickly
as possible. Problems with unsupported software should be mailed to the
owners of the project.
For Starters
The commands below can be typed in any shell you have running in
your account. A shell is the basic user-interface in UNIX. You will
recognize it as a window which displays a prompt (for example,
"~ ->"), where you can type commands. For the commands listed
below, parameters enclosed in [ ] means that they are optional.
Parameters enclosed in < > must be provided for the command
to work correctly. For clarity and completeness, the most commonly used
options for many of the commands below have been listed to give you a
better idea of the power and abilities of some of the unix tools you
have available to you.Supported vs. Unsupported Software
All of the software available in the CS department falls into two
catagories: supported software and unsupported software.
Supported software includes those applications which are maintained by
the Technical Staff (tstaff). This means that tstaff will do everything
possible to fix problems or catastophes that occur when you are using
one of those applications. Unsupported software is generally maintained
by fellow students, who try to make their projects as stable as
possible, but no guarantees are given if the application should
break.
Basic UNIX Commands
cp -i will make copy interactive, i.e. confirm and give
warnings if you are about to overwrite an existing file.
cp -r will make the copy recursive. Useful if you wish to
copy the contents of an entire directory.
du -a lists all the files
du -s prints just the sum of the sizes of the files
grep -i will ignore the case of the string.
grep -c will give the count of the number of lines where the string appears
grep -v prints all lines except those that contain the pattern
ls -a lists all the files in the directory
ls -F formats list with symbols so you can distinguish types
of files. Put a slash (/) at the end of a directory, an asterisk (*) if
the file is an executable, and an at-sign (@) if the file is a symbolic
link.
mv -i will make the command interactive, i.e. confirm and
warn you if you are about to overwrite an existing file.
ps -u <account> will list the process running from
that account. Especially useful if you are trying to figure out if you
are already running a program in the background. ps without any options
will print out the programs that were started in the current shell and
are still running.
ssh -l <account> <hostname> will log you in
as the specified user.
tar cvf will create a tar file. After tarring is complete,
the files you tarred will still exists. Tarring does not eliminate the
files, just copies them into one larger file.
tar xvf will extract the files which are contained in the
tarfile. After untarring is complete, the tar file will still exist in
addition to the files that have been extracted. This is nice especially
if you just wanted to look up something. You will not need to retar the
files all over again.
wc -l counts the number of lines in a file
wc -w counts the number of words.
wc -c counts the number of bytes.
wc -m counts the number of characters.
Web Browsers, E-Mail Programs, and Newsgroup Readers
Editors
Printing and Print Queue Commands
All printouts by default spool to the CIS printer. Printouts generally
take five to ten minutes before they can be picked up at the CIS
Distribution Window in the CIT Atrium.
a2ps -P display will preview the output (with gv) instead of
sending it to the printer.
a2ps -1 will fill the whole page in portrait
mode.
a2ps -2 (the default) will print two columns per page in
landscape mode.
a2ps -3 uses three columns.
a2ps -4 prints 4 "pages" per page, arranged in a rectangle.
a2ps -B gets rid of the headers that a2ps puts at the top and
bottom of your page, if you want a cleaner printout.
Useful Commands and Applications (Unsupported)
loc -a lists all the users, regardless of idle time
loc -g <groupname> finds all of the people who are in
a specified group
lw -f prints the full name of the users in the lab
lw -n prints the login of each node
lw -i prints the idle times for each node in the lab
xlock -mode
Page Owner: Student Lab Consultants
Last Modified: Tue Dec 20 11:38:47 2005