For several commands whose descriptions would have been too lengthy, only a brief description is given.
cat chapter1 chapter2 > book
Concatenates the files named chapter1 and chapter2 in
the current directory and collects them in a file named book on
the current directory.
cat chapter12 | egrep broccoli > broccoli
Feeds
the contents of the file chapter12 to the egrep filter which then only keeps the lines
having the word broccoli. This is, in turn, saved in the file
named broccoli.
Remark: Blank spaces above just before or after > are unimportant, they just make it easier to read.
cd Tex
Change to the subdirectory (of the current directory) named Tex
cd Tex/mypapers
Change to the sub-subdirectory (of the current directory) named
Tex/mypapers.
cd /Users
Change to the subdirectory Users of the root directory.
cd
Changes to your own home directory from any other directory.
cd ~ksmith/public_html/
Changes to the user ksmith's public_html directory.
cp .cshrc .cshrc3-24
copies the file named .cshrc to the file named
.cshrc3-24
cp *.bak tmp/
Copies all files whose names end .bak to the subdirectory
tmp of the current directory. The subdirectory tmp must
already exist.
cp -i *.bak tmp/
Same as above, but warns before overwriting a file with the same name.
crypt F(x)=12 < exam1 > green
Encrypts a file named exam1 using the key F(x)=12. Here
the encrypted output file is named green.
crypt F(x)=12 < green > happy
This deciphers the above file and saves the output in the file
happy. One must use the same key, but the output file need
not have the old name (you may not know the original name anyway).
find /usr/local/ -name pico -print
Find all files named pico in the directory /usr/local/
and its subdirectories. The list is printed on the monitor.
gzip exam1.ps
This creates the compressed file named exam1.ps.gz and deletes
the file exam1.ps
gunzip exam1.ps.gz
Gives the original file exam1.ps and erases the compressed file
exam1.ps.gz
head 141* | more
Displays the first 10 lines of the
files whose names begin with 141 and uses more to display them one screen at a time.
less chapter1
This is equivalent to cat chapter1 | less
ls
Alphabetical list of all the files in the current directory except
those whose names begin with a period . (thus, one frequently begins the
names of a configuration file with a period so it is hidden from a routine
directory listing).
ls -a
Alphabetical list of all the files in the current directory, including
those whose names begin with a period.
ls -l (or ls -al )
Long directory listing (including size, date the file was last modified,
and who has permission to read, write or execute). The second version
also includes all files whose names begin with a period.
If the directory has many items, it will not fit on one screen.
To avoid the listing scrolling off the screen one can either pipe the
output through the commands more or less, as
ls -al | more
ls -lt *bak
Long listing (ordered by the time the files was last modified)
of all files whose names end with bak.
mkdir Tex
Make a new subdirectory named Tex in the current directory.
mkdir Tex/classes
Make a new subdirectory named classes in the directory Tex.
mkdir Tex/classes; cd Tex/classes
Make a new subdirectory named classes in the directory Tex
and then immediately change to that directory.
more chapter1
This is equivalent to cat chapter1 | more
mv chapter1 chapter1.old
Renames chapter1 as chapter1.old
mv *.bak tmp/
Moves all the files in the current directory whose names end with
.bak to the directory tmp.
mv -i *.bak tmp/
Same as above but warns before overwriting a file that already exists.
rm book *.dvi
Removes the file book and all the files in the current directory
whose names end with .dvi.
rm -i book *.dvi
Same as above but is interactive, prompting before removing each file.
rm -r book
Recursively removes the directory book and all of its files and
subdirectories. rm -ri book is the interactive version.
Note: USE WITH CAUTION!
rmdir math141
Removes the (already empty) directory math141.
tar cvf letters1994.tar letters
Collects all of the
files in the subdirectory letters (and its subdirectories)
into one large file letters1994.tar in the current directory.
The original files are not deleted or changed. One might then use
gzip to compress the tar file:
gzip letters1994.tar
to create letters1994.tar.gz (and delete
letters1994.tar). One can combine these into one step with:
tar cf - letters | gzip > letters1994.tar.gz
tar xvf letters1994.tar
Reverses the above and "untars". If needed, this creates the
subdirectory letters or any sub-subdirectories. The file
letters1994.tar is not erased.
zcat letters1994.tar.gz | tar xf -
The zcat command uncompresses the
gzipped file which is then "untarred" by tar xf -
(note the final -). This avoids creating the file
letters1994.tar, which may use critical disk space. On some
computers the program zcat might be named
gzcat.
diff chapter1 chapter1.old
In the output, the lines beginning with "<" refer to
the first file, those beginning ">" refer to the second file.
dvips exam1.dvi (or just dvips exam1)
Prints the file exam1.dvi on the default printer.
dvips -oexam1.ps exam1.dvi (or dvips -oexam1.ps exam1 )
Processes the file exam1.dvi and saves the output
in the file exam1.ps rather than printing it immediately. At
a later time one can use the command lpr
exam1.ps to print this.
egrep Johnson chapt2 (or egrep -i johnson chapt2)
Display all the lines in the files chapt2 that contain the word
Johnson. The case insensitive version using
egrep -i does the same but will also catch JOHNSON,
JohnSon, johnson, etc..
fmt myfile
Formats the text file myfile so that each line has at most (by
default) 72 columns.
latex2html homework3.tex
This produces the subdirectory homework3 containing the main
file homework3.html and other graphics and html files that that
file uses.
ispell chapter1
Checks the spelling in the file chapter1.
lpq
List the jobs queued to be printed on the default printer.
lpq -P4E1
Lists the jobs queued to be printed on the printer named 4E1.
lpr chapter1.ps
Prints the file chapter1.ps on your default printer.
lpr -P4E1 chapter1.ps
Prints the file chapter1.ps on the printer 4E1.
lprm 235
Removes job 235 from the print queue.
sort file1 > file1.s
Sorts the lines in file1 by the characters at the beginning of
each line. Store the output in file1.s. ( >
file1.s is equivalent to -o file1.s ).
sort +2 file1 > file1.s
As above, but sorts
beginning with the 3rd field; by default -- which can be changed -- fields
are separated by whitespace, i.e. spaces or tabs. The output is again
saved in file1.s
tex exam1.tex (or tex exam1 )
Processes the file exam1.tex and creates exam1.dvi
xdvi exam2.dvi &
Displays the file exam2.dvi (the optional & at the end of the line
frees up that terminal window for subsequent commands without requiring
that you first exit from xdvi).
ghostview diagram1.ps
Exhibits diagram1.ps. You can change such items as orientation,
and magnification.
tifftopnm touch.tiff | ppmtogif > touch.gif
Changes the file touch.tiff to touch.gif.
xpaint &
This opens xpaint, which has both a toolbox and a
canvas window. Click on File to edit an existing picture
or icon.
xv touch.gif
Displays touch.gif which you can then process using
xv's tools.
at 0430 lpr myfile.ps echo "myfile.ps was just printed" [Ctrl D]
date
du
Give size of each directory.
du -s
Give summary total only.
du -a
Give size of each file.
kill 2765
Terminate process number 2765. This gently stops the process,
automatically closing all opened files and cleaning up. If this does not
kill the process, then use kill -9 below.
kill -9 2765
Terminate process number 2765. Not gentle. You may need to do your own
cleanup, but at least you almost always get the process to stop. If this
doesn't work, ask an expert.
man man
Use this to read the Unix man page on the command man itself.
man ls
This gives the Unix man page for the command ls.
man -k print
This gives a list of all the Unix commands concerning
"printing$quot;.
ps -aef | egrep jsmith (System V Unix, recent SGI or Sun computers)
ps -aux | egrep jsmith (BSD Unix, on all NeXT computers)
List all of the processes running that have the word jsmith in
their description. In practice, the user jsmith will use this to find all
the processes she is running.
pwd
stty
Display the current terminal settings.
stty rows 49
Set the screen size to 49 rows.
which emacs
Gives the full pathname to the emacs command, including any shell aliases
being used.
who
Gives a list of the userids of those currently logged in.
ftp math.berkeley.edu
To initiate a file transfer with the computer math.berkeley.edu
After connecting, one gives various file transfer commands, such as:
get file2 to get (receive) file2 mget chapter* (multiple) get all files whose names begin with chapter. put, file1 to put (send) file1 mput *.tex (multiple) put all files whose names end with .tex
kermit
After starting kermit one uses the commands
send chapter1 sends chapter1 to the remote computer receive receive files from the remote computer; you then transfer control to the other computer and tell it what files to send
rlogin mail.sas.upenn.edu
rlogin mail.sas
You can use this shorter name if you are currently on another
computer also in upenn.edu
telnet mail.sas.upenn.edu
telnet archimedes.math
You can use this shorter name if you are currently on another
computer also in upenn.edu
sz *.tex
Send all files in the current directory whose names end with
.tex
rz -b
Prepare to receive binary files from the other computer (the
-b means binary). You must then use the other computer,
perhaps at home, to specify which files are to be sent.
shell: .cshrc .login .logout .profile .plan X: .chestrc .sgisession .Xdefaults editors: .emacs .neditrc mail: .mailrc .elm/elmrc .elm/aliases.text .forward .vacation netnews: .newsrc .tin/tinrc