Advanced Unix Commands

Again this list is due to Per Kistler. Thanks Per !

See the commands of all users See the commands of a particual user Show entries for a specific commandpattern Show all entries for commands staring with "l" Swho the output in reverse order

:: acctcom | tail -20 acctcom -u <username> | tail -20 acctcom -n <pattern> | tail -20 acctcom -n '^l' | tail -30 acctom -b | more :: agrep -2 'macropperswan' <file> :: at now + 5 days < scriptfile :: awk '{print $1}' <file> awk '{print $2,"\t",$1}' <file> awk '{print $1 + $2}' <file> awk '/money/ {print $NF}' <file> awk '$2 ~ /money/ {print $0}' <file> awk '$3 !~ /A$/ {print $0}' <file> ::

Find words with possible misspellings (here 2)

Execute a command once in the future

Take first column of a file Take first two colums inverted Print sum of first two colums Find lines with "money" and print last column Find lines with "money" in second column Find lines without "A" at end of 3-rd column

Bourne again shell. Best interaktive shell right after zsh

Calculate sin(5)

:: echo 's(5)' | bc -l :: bg :: break ::

Put last stopped job into the background

Leave the inermost loop (while/until/for)


Stop a print job allready started

cancel <jobid> ( as found with lpstat -o) ::

Selective structure in sh/bash/ksh

Compile a file.c

:: cc -o <outfile> <infile> :: chgrp <newgroupname> <file> :: chown <newowner> <file> :: cmp <file1> <file2> || <command> :: man <command> | col -b | <printcommand> :: crontab -l crontab -e 10 5 * * 1 /home/fred/foo.ksh :: crypt password < infile > cryptfile crypt password < cryptfile > cleanfile ::

Change group of a file

Change owner of a file

Act on the difference of two files

Printing the man pages without thousand "^H"

See your crontab file Edit your crontab file Every monday on 05:10 do /home/fred/foo.ksh

Encrypt a file with a password Decrypt the above file

Oldest Berkley shell

Get the hostname field from the last output

:: last | cut -c11-40 :: date <mmddhhmm> date +%m :: df -k

Set the date (root only) Special format of date (e.g. month only)

See the used space of the disks in kB

Compare two directories

:: dircmp <dir1> <dir2> :: dtksh :: du -ks :: ed <file> :: egrep '(A|B)' <file> egrep -v '(A|B)' <file> :: ex -s file <<EOF g/money/s//cash/ EOF ex -s file < scriptfile :: expr 10 % 7 expr $var : 'string' expr $var : '[^0-9]*\([a-z]*\)' :: fg :: fgrep '*,/.()' <file> :: file <file> :: find / -type f -name <file> -print find . -type f -name "*<foo>*" -print find / -type f -name core -exec /bin/rm -f {} \;

dtksh is a ksh93 with X11 graphics

du = diskusage

Commandline editor. Only used if all else fails

Grep with "or" Exclude a and B

Edit a file from within a shell script Edit a file with a script

Calculate modulus Check for string in variable Show first group of digits in string

Put the last stopped job into the foreground

Find a string which is not a pattern

See the file type (e.g. ascii)

Find a file in the whole computer Find a file pattern Delete all cores in the system

find . -local ..c" -print | xargs -i cp {} {}..bak find ..Find all files with a word in them Find files modified longer than a month ago Use found files more then once with xargs Don't search in nfs mounted filesystems Follow the links while searching Look for files larger than 1 megabyte Run find but discard the "permission denied"'s Find all manualpage directories Find all directories with write permissions find . -type f -exec grep -l <word> {} \. -follow .f grep -c '[Ss]uccess' <file> grep -i 'lAbEgF' <file> grep -n 'mo.then commands.*/(catman| man)$' find / -type d -perm -002 -print :: GAWK The gnu version of nawk GREP Find patterns in lines of files or stdin Find lines without pattern Find files which contain a pattern Count lines with pattern Search while ignoreing case Print a line number in front of the line :: grep '[a-z][0-9]' <file> grep -v '^From' <file> grep -l '^[cC]' *. find /path -size 1000000c -print find . (ksh88) KSH93 ksh93 with real number arithmetics :: ksh93/ksh..depends on the system :: LINE ...*y' <file> :: hinv -v :: HINV Get infos about your host on silicon graphics IF then else ENDIF Branching structure in csh/tcsh IF then else FI Branching structure in sh/bash/ksh :: if [[ condition ]].fi :: KSH Korn shell.. -type f -ctime +30 -print find . -name "*. 2>/dev/null ( in sh/bash/ksh only) find / -type d -print | egrep '.. find .

but formated Mount a cdrom to /cdrom Mount a diskpartition to /usr NAWK Enhanced version af awk NL Number text lines from a file :: nl -bt -nln <file> .do :.done :: ln a B ln -s a B rm B :: lp <file> lp -d <destination> <file> :: lpstat -a lpstat -o lpstat -d lpstat -p lpstat -r :: make make <target> make -f <mymakefile> make -n <target> :: mkdir -p <path>/<path>/<path> :: mount mount -p mount /dev/cdrom /cdrom mount /dev/dsk/c0t3d0s5 /usr :: LN Make a hard link b to file A Make a symbolik link b to file A Romove link B LP Print file on default printer Print file on specific printer LPSTAT Show all printers Check the printer queue Show defoult printer destination Show printer status Show sceduler status MAKE Make the first target of a makefile Make a specific target of a makefile Make according to another file than makefile Just show what would be done but don't MKDIR Make a directory with subdirectories at once MOUNT See what is mounted See what is mounted.Reprint lines until eof (sh/bash/ksh) while line.

*$" :: reset :: rpcinfo -p <host> :: rsh <host> <comand> :: rusers REGCMP Compile a regexp from a file Entry in the file above (example) RESET Reset the terminal after having messed it up RPCINFO Get portinfo from <host> RSH Execute a command on a remote computer RUSER See who is logged in in the local network .*[0-9. PASSWD Change your password Delete password of a user (as root) Change password of a user (as root) PASTE Put single col files into one file with as many cols PERL Programming language which can also be used from the commandline or from ksh scripts.NOHUP Start a job imune to logouts :: nohup <command> & :: osview :: pack <file> :: passwd passwd -d <username> passwd <username> :: paste <file1> <file2> > <newfile> :: OSVIEW View system activity on SGI PACK An old form of compress. PR Format an ascii file for printing (76 lines) Copy a file from one computer to another :: pr -l76 -h"title" <filename> rcp <comp1>:/<path>/<file> <comp2>:/<path>/ :: regcmp <file> varname "^[a-z]. Use gzip instead.

but mostly doesn't work :: SCRIPT This logges all which passes the screen :: script <logfile> :: sed -e 's/fred/john/g' <file> sed -e 's/[0-9]+/number/g' <file> sed -e 's!X!<font color="#FF0000">X</font>!g.RWHO Like rusers.suf1 to files with suffix .\)suf1/mv & \1suf2/' | sh sed -e '/C/s/A/B/' <infile> ><outfile> sed -e '/you owe me/d' <infile> > <outfile> sed -f <commandfile> <infile> > <outfile> :: SED Substitute a string in a file Substitute a pattern in a file Change all "X" to red in a html file Rename files with suffix . ls -1 | grep '\.suf1$' | sed -e 's/\ (.suf2 Change a to b but only on lines with C Delete all lines which contain "you owe me" Have many editing commands in a file SH Shell.*\. SHUTDOWN Stop the system :: shutdown -h now :: sleep 10 :: sort <file> sort -n <file> sort -r <file> sort -u <file> sort +2n -t: /etc/passwd | cut -d: -f3 :: spell <file> spell +<okfile> <file> :: SLEEP Tell ashell script to pause for 10 seconds SORT Sort lines of a file alphabetically Sort lines of a file numerically Sort and reverse the order Sort and take only one of equal lines Show the used user ID's from /etc/passwd SPELL Check for misspelled words in a file Check. Ksh is it's successor. which is standard for universal shell scripts. The oldest AT&T shell. but ignore words from okfile SPLIT .

Split a big file for putting on floppy Put splitters together if their name starts with x

split -b1m <file> cat x* > <newfile> :: strings <file> :: stty -a stty erase "^H" stty -echo stty echo :: su su su <username> :: tail -f <file> | grep <pattern> :: tar cvf <outfile>.tar <dir> tar xvf <file>.tar gzip -dc <file>.tar.gz | tar xvf tar xzvf <file>tar.gz tape=/dev/rmt/0mbn tar cv <dir> tar xv tar xv <file> tar t (cd fromdir && tar -cBf - . ) | ( cd todir && tar -xBf - ) ::

Read ascii strings from a binary file

Show the terminal settings Change the deletions chatachter to "^H" Do no more show what is typed in scripts Show the typeing again

Become root with own environment Become root with root environment As root become another user

Report certain lines from a growing file

Pack together a whole directory Unpack a tar file Unpack and untar a file with normal tar Unpack and untar a file with gnutar Set the tape variable in the .cshrc for tar Put a dir onto the tape Retrieve the dir from the tape Retrieve only a single file from the tape Get table of contents from tape Copy a directory with links and propper permissions

Good interaktive shell from Berkly. Only second to bash.



Put output on screen and append to file

who | tee -a > <file> :: test -a <file> test -O /usr/bin/su test -n "$foo" test $var1 -gt $var2 if [[ -a <file> ]];then ...;fi :: time <command> :: find /myscratch -exec touch {} \; :: tr '[a-c]' '[x-z]' < infile > outfile :: trap "mysub;exit" 0 1 2 15 :: ln -s /usr/bin/true ranlib :: truss <command> > /dev/null :: typset :: tty :: ulimit :: umask umask 077 :: sort <file> | uniq -c

Check for a file Check for beeing root Check for astrin beeing non null Compare two strings numerically In a ksh script one uses "test" indirectly

See how much time a command needs

Protect against the the crontab

Replace a with x, b with y and c with z

Catch "^C" etc. and execute a subroutine

Make a non extisting command to return 0

See what system calls a command uses

Show the functions which are active

See the device for your terminal

Show the max file size you can write

Show your umask for new files Set a save umask

Find a line of each equal ones an say how many

Find uniq lines

sort <file> | uniq -u :: uptime :: uuencode decodedname namenow > codedname :: uudecode <file> :: wait $jobid :: vi <file> :: wc -l <file> :: <command> | xargs -i grep 'pattern' {} :: xon <host> xon <host> <X-client>

Show how long the computer is running

Encode a file for mailing

Decode a uuencoded file

Wait for a background job to terminate

The main unix editor

Count lines in a file

Execute a command for each line from pipe

Get an xterm from another computer Get anything from another computer

More Advanced Unix Commands
More information on almost any of the commands that follow can be found in the on-line manual pages. Type ``man command-name'' at the command line to look at the manual page for the command ``command-name''.

 Viewing and Printing,  TeX and LaTeX files : Dvi

 Run two or more jobs at once : &, bg, fg

 Run a big job with low priority : nice  Compressing / Uncompressing: compress,  Graphically display processes running : gr_top uncompress, gtar, tar, gzip, gunzip

 Suspend a job : [CTRL]-z Redirection  Take output from one job and make it the input to another job: |. If there are a lot of files in the current directory. < .dat''. grep Colors  editing colormaps : bitmap  view a color based on decimal values (on SGI's) : cedit  Text Filters / Pattern matching | Pipe symbol .dat'' will put the names and permissions of all the files in the local directory into a file named ``names.send the output of one process into another process. For example. This symbol will send the output of a command to the specified file. >  Kill a job : [CTRL]-c . For example. along with information about those files. you might want to try ``ls -l | more''. This symbol will take everything in the file and send it to a process as if it came from the standard input ( usually the keyboard ). Another useful one is ``ps -ef | grep USERNAME''. the . replacing USERNAME with the user you're looking for: it will only show the lines with that user in them. you can send the output to ``/dev/null'' ( ``ls -l > /dev/null'' would send the names to ``/dev/null''. > filename Redirect output to a file. though it doesn't really serve a purpose in this example ). < filename Redirect input from a file. kill  copy files while filtering with given script : sed  search file for pattern : awk. If you don't want to see any output from a command. which makes ``ls -l'' send all of it's output to ``more'' which then displays it one screenful at a time. ``ls -l > names. the ``ls -l'' command prints out all of the files in the current directory. and the ``more'' command displays only one screenful of information at a time. For example.

Xroff {-Pprintername}filename Xroff prints out documents that use the nroff /troff text processing commands. %# Part of the process control available under the csh shell. If the process doesn't require input from the keyboard or output to stdout ( usually the screen ). For more information. and spell will print out the misspelled words.``spell'' program reads from standard input and prints out the words that it thinks are misspelled. So. This parameter isn't necessary if you've set your ``PRINTER'' environment variable (do this with the ``setenv'' command ).22804 Suspended (signal) elm [3] + 22808 Suspended badb Where the first number ( in brackets ) is the job number.the ``Nroff/Troff User's manual'' and the ``Troff Tutorial'' are both worth looking at. More information on TeX and LaTeX can be found in the printed manuals.dvi Dvi prints out ``filename. This could take a while before it finishes. Vroff filename Vroff is an X-windows previewer for documents that use the nroff/troff text processing commands. and spell would read the file instead of the keyboard. you can type ``spell<RET>''. -c Part of the process control available under the csh shell. and re-enter it with ``fg''. <CTRL>-Z sends a terminal stop signal to the current process. If you wanted to check all of the words in a file. -z Part of the process control available under the csh shell. then type in the words that you want to check followed by <CTRL>-D ( the end of file mark ). This allows you to temporarily exit a running process. ``%#'' ( where ``#'' is replaces with a job number ) will re-enter a suspended process. If you use ``jobs'' to find the processes that you have suspended or are running in the background. Say the process is ``cat file1 file2 > file3'' and the that file1 and file2 are large. Dvi {-Pprintername}filename. ``-Pprintername'' tells Dvi which printer to print out on.tex [2] . then after using ``<CTRL>-Z'' you can make the process run in the background with ``bg''. To make it run in the background ( which will allow you to continue to work while it is running ). look in the document formatting portion of the printed manuals in room 252 . For more information. <CTRL>-C sends a termination signal to current process. what you get back might look like the following: [1] 21998 Suspended emacs useful. The process must not need input from the keyboard or output to the screen.the ``Nroff/Troff User's manual'' and the ``Troff Tutorial'' are both worth . available for borrowing at the EMBA computer facility. like so: ``cat file1 file2 > file3 &''. & Make a process run in the background automatically. This usually kills the current process. which are produced by the TeX and LaTeX text processing programs. and typing ``%1'' at the command line would cause you to re-enter the emacs job. the easiest thing to do would be to use the ``&''.dvi'' files. you'd redirect the standard input to come from the file ``spell < filename''. The ``jobs'' command will show you what processes you have done this to. look in the document formatting portion of the printed manuals in Votey room 252 .

Sadye. You can see the status of the job with ``jobs'' or ``ps''. It is interactive. awk Pattern scanning and processing language. current and historical stock quotes.) cedit X-windows color viewer. This parameter isn't necessary if you've set your ``PRINTER'' environment variable ( do this with the ``setenv'' command ). as well as detailed corporate and industry data. This service can give you up-to-the-minute news. a lexicon of investment terminology and an encyclopedia. then you can make it run in the background. Griffin. Runs from SGI machines. This will ask you the name of the function that you wish to find. compress will compress its standard input. (best if run from SGI machine.looking at. Shows what color a particular decimal value of RGB looks like. the MCI Mail service. type ``<CTRL>-Z'' and then ``bg''. Type ``badb'' at the command line. while keeping the same ownership modes. To go to a function definition in emacs. and there is on-line help. Bitmaps can be used for X-window icons and backgrounds. -Pembalaz ).``awk 'length < 80' filename'' prints to stdout ( usually the screen ) all of the lines in the file ``filename'' that are shorter than 80 characters. djns Dow Jones News Retrieval Service. If you start a process that doesn't require input from the keyboard or output to the screen. Say the process is ``cat file1 file2 > file3'' and the that file1 and file2 are large. bitmap {filename} X-windows bitmap viewer/editor. Emacs and epoch use entries in the tags file to locate and display a definition. movie reviews. bg Background a stopped job. Official Airline Guide flight and fare information. Whenever possible. type ``M-.Z''. ect . and SUN server (Newton. ``awk'' can run it's own script files ( ``awk -f scriptfile inputfile'' would run the script file on the input file ). If you start the process.e. a computerized shopping service. etags Creates a tags file for use with emacs and epoch.. or it can accept quick scripts on the command line . Type it . This could take a while before it finishes.. The process is now backgrounded. badb BADB ( Business ADministration Database ) is used to access the Stock Exchange information supplied on the CRSP and Compustat tapes.'' ( Meta period ). each file is replaced by one with the extension ``. If ``filename'' isn't specified. Also available in this unique service are a wide variety of general interest databases. compress {filename} Reduces the size of the named file using adaptive Lempel-Ziv coding. and then realize that you want to make it run in the background ( which will allow you to continue to work while it is running ). ``-Pprintername'' specifies which printer to send the print job to ( i. including sports and weather reports. and choose the data base that you wish to enter. Very useful for making text filters. A tags file gives the location of functions and type definitions in a group of files.

fg {%jobnumber} Run a currently backgrounded process in the foreground. gr_top Graphically displays processes ordered by %CPU usage. ``gtar tvf archname'' will print out the names of all of the files in the archive. All files are changed to belong to the person doing the extraction.print names of the files and the operation performed on them. grep searches it's standard input for the the string or expression. latex filename.22804 Suspended (signal) elm [3] + 22808 Suspended badb Simply typing ``fg'' at the command line will put you back in the process that has the ``+'' in the 2nd column. For more information look in the printed manual pages. So. ``v'' means verbose . if there are none. you might not get the correct one on the first try. and the ``f archname'' gives the name of the archive that you want to do the operations on. kill -9 {PID}{%job-number} Terminates a process with the process id of PID or the specified job number. and may be printed out with ``Dvi''. ``c'' of ``cvf archname'' in the command line means create the named archive.'' ( Meta comma ) until you reach the one that you want. If what you typed in is found at the beginning of a number of functions. gtar's command line parameters are similar to those of tar. To create an and press return. gtar GNU project's version of ``tar''. gtar has the added advantage of not trying to keep the original file ownership of files being extracted. give you a file named ``filename. it prints out the line that contains it along with the filename of the file that the line is from. This file can be previewed with ``xdvi''. keep typing ``M-. See ``jobs'' and ``ps'' for information on how to find PID's or job numbers. More information on the LaTeX language is available in the LaTeX manual which you can borrow from an EMBA counselor. Example: ``grep chance *'' will search all of the files in the current directory for the word ``chance''. grep {string}{-e expression}{filename(s)} Along with egrep and fgrep. if the PID is 12345. provided that it is in the archive in the first place. If you use ``jobs'' to find the processes that you have suspended or running in the background. ``latex'' will report errors and. you might type ``gtar cvf archname file1 file2 file3''.tex LaTeX is a text processing language ( a superset of the TeX language ). ``gtar xvf archname'' will extract all of the files from archname. If this is the case. in this case it would be the ``badb'' process. . grep is used to search files for a string or a regular expression. what you get back might look like the following: [1] 21998 Suspended emacs useful. which would put file1-3 in the archive named archname.dvi''. interleaf A WYSIWYG ( What You See Is What You Get ) editor and desktop files organizer available on the Sun machines.tex [2] . When grep finds the requested string or expression. then ``kill -9 12345'' will kill the job. and ``gtar xvf archname filename'' will extract only ``filename'' from the archive. ``fg %2'' will put you back in the ``elm'' process. If the job number is 5. then ``kill -9 %5'' will kill it. If no ``filename'' is given. and ``latex'' compiles this language into a device independent (dvi) representation of the resulting document.

This can be handy for looking at nroff/troff files that you are writing ``nroff filename | more''. pushd {directory} Pushes ``directory'' on to the directory stack.print names of the files and the operation performed on them. ``v'' means verbose . Use pushd to place new directories on the stack. popd Removes the top directory from the directory stack. and typing popd will make the stack look like this: ``/ /usr/local/bin''. ``tar tvf archname'' will print out the names of all of the files in the archive. and the ``f archname'' gives the name of the archive that you want to do the operations on. Finally if you type ``pushd +2'' the stack will look like this: ``/bin / /usr/local/bin''. ``tar xvf archname'' will extract all of the files from archname. plus adds to. the stack will look like this: ``/ /usr/local/bin /bin'' and you will be in the root directory. placing you into the new top directory. nice {command} Runs a {command} with low priority so others dont experience 'lagg-time'. and extracts files from tape archives. pushd swaps the two top directories on the stack. you might type ``tar cvf archname file1 file2 file3''. ``Vroff'' is a graphical previewer of nroff/troff files that will show different fonts and point sizes ( which the nroff program won't ). sort works on the standard input. ``sed'' can take its instructions from a file ( -f scriptfile ) or the command line ( -e script ). For example ``sed -e 's/test/testing/g' filename'' will replace every instance of the word ``test'' with the word ``testing'' and print the result to stdout ( usually the screen ). tar Creates tape archives. If ``directory'' isn't specified.usually the screen ).nroff {filename} ``nroff'' and ``troff'' are text processing languages. which would put file1-3 in the archive named archname. If you then type ``pushd''. ``c'' of ``cvf archname'' in the command line means create the named archive. If the directory stack looks like this ( use ``dirs'' to print out the current directory stack. and ``tar xvf archname filename'' . and you type ``pushd /usr/local/bin''. then the new stack looks like this: ``/usr/local/bin / /bin''. Without a ``filename''. placing you into whichever directory is now on the top of the stack. and you will be in the /bin directory. sort {options}{filename} Sorts the input lines alphabetically by default. Otherwise it sorts the lines in the file and writes the sorted output to stdout ( usually the screen ). and the leftmost directory is top of stack): ``/ /bin''. If the stack consists of the following ( leftmost is the top of the stack ): ``/usr / /usr/local/bin''. To create an archive. Useful for making text filters. then you will be in the ``/usr'' directory. numerically if given the ``-n'' command line option. Sometimes has permission problems when extracting files by maintaining the ownership of the files in the archive. and you will be in the /usr/local/bin directory. or for looking at the manual pages that come along with software that you get from the Internet ``nroff -man filename | more''. placing you into that directory. Use popd to remove stack entries. If you have this problem. showing what the file will look like when it is printed ( prints to stdout . The ``nroff'' program is an ASCII previewer for nroff/troff files. putting you in the root directory ( / ). sed {-e script}{-f scriptfile}{filename} Stream editor. try ``gtar''.

xarchie X-window interface for Archie servers. and then press return.Z'' to the end of the filename). then type ``wp51''. it helps you figure out where you can ftp a particular file from ). Say you want to find out where you can ftp the gdb debugger from .1. ``uuencode'' changes binary files into ascii files so that they can be easily e-mailed or posted to the news. and look for any file that it know about that contains the string ``gdb''. For the X-windows version of wp51 you must first set your ``DISPLAY'' environment variable ( ``setenv DISPLAY dname:0''.e. Archie servers provide information about files available for ftp anywhere on the Internet. and then you must tell it where to find the appropriate fonts by typing ``xset fp+ /usr/local/lib/X11/fonts/wp'' on the console of the machine that you are working on. Xarchie will then connect to one of the archie servers ( which one can be controlled though the ``settings'' menu ). you must first unset your ``DISPLAY'' environment variable ( ``unsetenv DISPLAY'' ). provided that it is in the archive in the first place. Available on Sun's. and the file found on your screen. newton. When decoded using ``uudecode'' the resulting file will be named ``file-label''. ( i.. then uuencode takes its input from standard-input. uncompress filename. then simply type ``wp51'' at the command line in one of your Sun windows ( griffin. You can then use ftp to get the file if you want it.Z Uncompresses files that have been compressed with the ``compress'' command (which automatically adds the ``. . uudecode filename Decodes files that have been encoded with the ``uuencode'' command. It will report the ftp servers. the'd type ``gdb'' in for the ``Search Term:''. sadye ). where dname is the name of the display that you are using ). uuencode {source-file}file-label Converts a binary file into an ASCII-encoded representation that can be sent using mail(1) or posted to a news-group. Type ``man command-name'' at the command line to look at the manual page for the command ``command-name''.will extract only ``filename'' from the archive. If you don't specify ``source-file''. For the ASCII version. wp51 WordPerfect 5. ``uuencode'' sends the encoded output to stdout ( usually the screen ). Basic Unix Commands More information on almost any of the commands that follow can be found in the on-line manual pages.

pine  Information on a person : finger  Information on people logged-on rwho  Info on Printers : printers  Compile a file : cc. pico  Transfer files over Network file): gv  Edit a file : emacs. CC  Debug a program : gdb  Whats in this file ? :more. gcc. which Networking  Check your mail or mail someone : mail . g++. kermit .Files  Display files in a directory :ls Environment  Keep getting "Can't open display: : 0" :setenv  Display current environment variables: env     Copying files : cp Delete file(s) : rm What kind of file is this ? : file Where is this file ? : find . less. cc++. cmp  Cancel print jobs :lprm  View a file in PostScript (. vi. cat  Printing a file : lpr  Check the print queue :lpq  Whats different with these two files ?diff.

ps Passwords  CHANGE YOUR PASSWORD ! passwd . ln  Create a directory : mkdir  Delete a directory : rmdir  Change permissions to a directory : chmod Processes  What program is running now? jobs. ispell Directories  Where am I now ?? : pwd  Moving around : cd . Change permission : chmod  HOW DO I QUIT !? : logout  Finding man page : man -k  Information on Servers : rupall  Moving files : mv  Did I spell that right?: spell.

For example. Otherwise. A typical invocation might be ``c++ -g file. you need read AND execute permission ). it will return you to your home directory. which is also available on the SGI. A typical invocation might be ``cc -g file. How much disk space do I have left ? quota -v c++ {filename} A compiler for the C++ programming language. and newer Sun machines. ``cd /'' will take you to the root directory. The next three characters. the last three characters ``r-'' show that everyone else only has read permission on that file ( To be able to enter a directory. it takes you to the directory named. Command line parameters are similar to the ``cc'' compiler's. Say you want file1 and file2 to be all together in one file named file3. If you type ``ls -l'' in a Nov 21 1992 profile Jul 16 23:44 zap* The first part of the line tells you the file's permissions. they would change the . GNU CC. the ``X'' file permissions start with a ``d'' which tells that it is a directory. cd {dirname} Change current directory. ``cc'' is ANSI compatible on the SGI.c -o executablename -llib''. chmod {options} Changes the permission modes of a file. Without a ``dirname''. IBM. Users can use ``chmod'' to change these permissions. ``rwx'' show that the owner has read. SUN. cc A compiler for the ``C'' programming language. Can also be used to concatenate files.cpp -o executablename -llib''. If file1 is first. ``r-x'' shows that people in the same group have read and execute permission on the file. You might try also try ``gcc''. you might get something like this: drwx-----drwxr-xr-drwxr-xr-x -rw-r--r--rw-r--r--rwxr-xr-x 3 2 3 1 1 1 ertle ertle ertle ertle ertle ertle 512 512 512 373 747 244 Jul 16 13:38 LaTeX/ Jun22 12:26 X/ Jul 13 16:29 Xroff/ Oct 3 1992 o. and IBM machines. then ``cat file1 file2 > file3'' will produce the correct file3. and execute permissions on this file. Finally. write. If the user didn't want anybody else to be able to enter the ``X'' directory. The next three characters. cat {filename} Prints out ( to the screen ) the contents of the named file.

With a ``login-name''. ctags Creates a tags file for use with ex and vi.c'' into the ``src'' subdirectory. Type ``<CTRL>-x <CTRL>h t'' to start a tutorial. This is useful in checking a file to be sure that it is text before you ``cat'' it out ( using ``cat'' on binary files can be a bummer ). ex and vi use entries in the tags file to locate and display a definition. etc. xemacs {filename} An X version of emacs. cmp {file1} {file2} Compares the contents of two files from eachother. Reports the first different character found. Some typical environment variables are ``DISPLAY''. it starts elm for an interactive session. In order to use this. Otherwise.tex: English text ertle@newton (56)> find . cp {filename(s)}{path} Copies files from one directory/filename to another. dbx {executable} Source level debugger. env Prints out the values for all the current environment variables.this means remove the read (``r'' ) and execute (``x'') permissions from the group (``g'') and others (``o'').dvi: data xwin. diff {file1} {file2} Displays all the differences between two files or directories to the screen. ``EDITOR''. file filename(s) Looks at ``filename(s)'' and tells what type of files they are. Allows you to set break-points.dvi: data useful. ``cp f1 f2'' makes a file ``f2'' identical to ``f1''. Example: ertle@newton (55)> file * useful. single step through the program. you must use the ``-g'' option when compiling your source code. ``cp *.tex: ascii text xwin.permissions to look like those of the LaTeX directory. date Shows current date and time. starts elm to send mail to ``login-name''. it will start editing that file. ``<CTRL>-x <CTRL>-c'' will exit from emacs. elm {login-name} Runs a screen oriented mail reader. and the line nummber.c src/'' copies all files that end in ``. like this : ``chmod og-rx X'' .hlp: English text useful. If filename is present. emacs {filename} Runs the most recent version of the text editor named EMACS ( produced by the GNU project ). A tags file gives the location of functions and type definitions in a group of files. and ``PRINTER''.

and also through emacs with M-x ispell-buffer. More information available under ``gcc'' in the emacs information browser ( M-x info while in emacs ). finger shows who is currently logged on the system. gossip Anonymous local message center. Type ``?'' to get help./ -name ``t*'' -print Which searches the current directory ( and all of its sub-directories ) for any files that begin with the letter 't' and then prints them out. Command line parameters are mostly similar to those of ``cc''. along with anything that is in that person's ``.ps} X PostScript previewer. ``ispell'' can be accessed from the command line. A typical invocation might be ``g++ -g filename. with limited information about them. ghostview {filename.plan'' file. More information available under ``gdb'' in the emacs information browser ( M-x info while in emacs ). compressed. finger {login-name} Without a ``login-name''. Be sure to type ``binary'' before transferring non-ascii ( executable. gcc GNU project's compiler for the C language.Searches the named directory and it's sub-directories for files. Most frequently called like this: find . giving logical alternatives to the misspelled words. and allows you to move around and make break-points in the source file. More information available under ``libg++'' in the emacs information browser ( M-x info while in emacs ). With a ``login-name'' you get more detailed info. This debugger is superior to dbx when called from inside emacs ( M-x gdb ) because it gives you a full-screen look at the source code instead of line by line. After connecting. ftp {address} File Transfer Program. jobs . To exit ``ftp'' type ``bye''. ispell filename Interactively checks the spelling of the named file. See also ``xarchie''. g++ GNU project's compiler for the C++ language. and ``get filename'' will transfer the named file into your local directory. Must use the ``-g'' command line option when compiling to use this debugger. ``ls'' will print out the files in the current directory. ``ftp'' transfers files to and from a remote network site. and ghostview is handy for looking at the resulting page or picture before you send it to the printer.cpp -o executablename -llib''. PostScript is a text processing and graphics language. etc ) files. gdb GNU project's source level debugger. and ``find'' will print out all incidences of this file. If you are looking for a specific filename. There are many ftp-sites that will let you log in as ``anonymous'' and get software/data/documents from them for free. Parameters are similar to those of ``cc''. archived. then replace ``t*'' with ``filename''.

{Source} can be a directory or a file. ``rwx'' show that the owner has read.tex [2] . ls -l {directory} Shows long directory listing.your PC at home to/from the computers at school.Shows backgrounded (<CTRL>-z'ed) processes with pid #'s. Typically. it stops it from being printed or printing out the rest of the way ). ln -s {source} {dest} Creates a symbolic link from {source} to {dest}. the ``X'' file permissions start with a ``d'' which tells that it is a directory. If you use ``jobs'' to find the processes that you have suspended or are running in the background. For more information. and execute permissions on this file. If no ``directory'' is specified. Another emacs editor. Allows you to move around with ease instead of using long and complicated path names. ``ls'' prints the names of the files in the current 21 1992 profile 16 23:44 zap* The first part of the line tells you the file's permissions. lpr {-Pprintername}filename Queues file ``filename'' to be printed on ``printer''.e. If no printer is named with -Pprintername. ``lpq'' will report on that printer. you'd get the job number from the ``lpq'' command. ls {directory} Shows directory listing. then the job will be queued on that printer. If no printer is specified with -Pprintername. lprm {-Pprinter}{job-number} Lprm removes a job or jobs from a printer's spooling queue ( i. kermit File transfer program. If you type ``ls -l'' in a directory. The next three characters. Jove doesn't have as many features as GNU's emacs. and then use lprm to stop that job. For example. write. The next . for instance. <CTRL>-x <CTRL>-c to exit. look in the online manual pages. what you get back might look like the following: [1] 21998 Suspended emacs useful.22804 Suspended (signal) elm [3] + 22808 Suspended badb jove {filename} Johnathan's Own Version of Emacs. you might get something like this: drwx-----drwxr-xr-drwxr-xr-x -rw-r--r--rw-r--r--rwxr-xr-x 3 2 3 1 1 1 ertle ertle ertle ertle ertle ertle 512 512 512 373 747 244 Jul Jun Jul Oct Nov Jul 16 13:38 LaTeX/ 22 12:26 X/ 13 16:29 Xroff/ 3 1992 o. but the ``PRINTER'' environment variable is set. less filename Displays file with minimal space. Allows you to transfer files between computers . but the ``PRINTER'' environment variable is set to a printer name. logout Exits and disconnects your network connection. but some people prefer it. lpq {-Pprintername} Reports all print jobs in the queue for the named printer.

``man write'' will give you the manual pages for the write command. 'pine' will read your mail. quota -v Shows current disk usage and limits. mv filename path Moves ``filename'' to ``path''. ``mv file1 file2''. printers Shows available printers and current status. you might try ``elm'' or ``pine'' at the command line. and ``man 2 write'' will give you the system call for ``write'' ( usually from the C or Pascal programming language ). ``mv file1 /tmp/''. ``man'' may give you any or all man pages for that ``name''. more filename Displays the contents of a file with pagebreaks. or ``M-x mail'' in emacs. Finally. ``mail'' checks to see if you have any mail in your mail box. ``mail'' will let you type in a message to send to that person. With no command line parameters. mkdir dirname Makes a sub-directory named ``dirname'' in the current directory. rm filename(s) Removes files. For more advanced mail processing. pico Very basic text editor. moving the file to a new directory. rmdir dirname .it is irreversible.three characters. man -k pattern Shows all manual entries which have ``pattern'' in their description. This might consist of a simple renaming of the file. you need read AND execute permission ) mail {login-name} Read or send mail messages. It is usually aliased ( in a user's . For example. If no ``login-name'' is specified. ``ps'' only shows processes that belong to you and that are attached to a controlling terminal. 'pine username' will prepare a message to 'username'. same interface as pine pine Full featured graphical mail reader/sender. or both ``mv file1 /tmp/file2''.cshrc file ) to ``rm -i'' which insures that ``rm'' asks you if you are sure that you want to remove the named file. ps {options} ``ps'' reports that status of some or all of the processes currently running on the system. the last three characters ``r-'' show that everyone else only has read permission on that file ( To be able to enter a directory. Without a section number. ``r-x'' shows that people in the same group have read and execute permission on the file. Usefull to use 'file' first so you don't display garbage. With a ``login-name''. man {section}name Shows the full manual page entry for ``name''. Careful with this one . pwd Shows current working directory path.

full page network news reader. spell {filename} Checks the spelling of the words in the standard input by default. setenv Sets environment variables. rwho shows all the people with under one hour idle time. Most frequently used to tell X which display you are on with ``setenv DISPLAY displayname:0''. vi {filename} Runs the screen oriented text editor named ``vi''. xclock . vn Runs the screen oriented network news program. and which printer you want your output to be printed on. This tells programs which editor you prefer. whereis {command} Reports the directory in which the {command} binary redides. Without ``-a''. but gives slightly different info. Also used in .cshrc file to set ``EDITOR'' and ``PRINTER'' environment variables. rupall Reports that status of local compute servers. With the ``-a''. Old and slow . checks words in ``filename'' if a name is supplied on the command line. The ``w'' command does the same thing. trn Threaded. Each line will be sent to the other person as you hit the carriage-return. which {command} Reports the directory from which the {command} would be run if it was given as a command line argument. who Shows who is currently logged on the system. xcalc X scientific calculator. Press <CTRL>-D to end the message. If a filename is specified. Quicker than vn. tin Threaded.Removes the directory ``dirname''. rwho Similar to ``who''. Type ``[ESC]:q!'' to exit without making any changes. full page network news reader. If a word is misspelled it is printed to stdout ( usually the screen ). Easier to use than trn. write loginname Send a message to another user.maybe try ``trn'' or ``tin''. Interactive calendar program with a notebook capability. but shows who is logged onto all emba machines as well as the local machine. rwho shows everybody that is logged on. Write won't work if the other user has typed ``mesg n''. xcalendar X calendar. you will be editing that file.

................... change your password chfn ............. compiles C source into a file named 'a................. xgdb X interface to the gdb debugger. talk (user) .................................. bc ... passwd Interactively changes your password.... easy to use text editor to edit files pine ... zip for IBM files tar ............. ls ...................... lynx ....... change your "Real Name" as seen on finger chsh ........ in alphabetical order logs off system make a directory remove directory (rm -r to delete folders with files) remove files change current directory shows help on a specific command pages user for chat ......... ftp (host) ... archie (filename) .. finger (emailaddr)... rm .. who .............. du ..... rmdir ............ chmod ...out' gzip ......... trn ..................................... combines multiple files into one or vice-versa ... tin..........................X clock..... logout .................... tail . change the shell you log into grep .. show directory.... man (command) . search for a string in a file show the last few lines of a file shows who is logged into the local system shows who is logged on and what they're doing shows more information about a user shows disk space available on the system shows how much disk space is being used up by folders changes permissions on a file a simple calculator make .. connect to another Internet site connects to a FTP site search the Archie database for a file on a FTP site connect to Internet Relay Chat a textual World Wide Web browser a Gopher database browser read Usenet newsgroups passwd ........................... xman X interface to the online manual pages................ df .. mkdir . w ..c) ...... easy to use mailer more (file) ........ best compression for UNIX files zip ....(user) is a email address write a user on the local system (control-c to end) pico (filename) ..... cd .............................................. views a file.............. irc .......... write (user) .. recieve a file (to the unix system) using zmodem telnet (host) ......... xforecast X interface to national weather forecast.......... gopher ... pausing every screenful sz ....... compiles source code gcc (file............. send a file (to you) using zmodem rz .........

lha .adds CR's to unix text files UNIX Commands Quick List UNIX is EASY! There are only ~45 commands that you have to learn to use a UNIX workstation.. Examples: ls file.1 lists presence of file.strips CR's out of dos text files unix2dos (file) (new) . Remote workstation is named hostname telnet hostname log onto remote workstation named hostname df -k print list of disks and current capacity (in kilobytes) setenv list environmental variables which command list location of executable command File Manipulation ls list contents of current directory.1 with expanded information . may not be on your system dos2unix (file) (new) .. you may want to review the Abbreviations Used in this Guide. un-arc'ers. • • • • COMMAND LISTS o Environmental Commands o File Manipulation o Directory Manipulation o Process Control System Security Typing Shortcuts Abbreviations Used in this Guide Environmental Commands logout or exit passwd date whoami or who am i who man command1 end terminal session change password print date & time list current user in that window list all users logged onto the workstation print on-line UNIX manual page for command1 start file transfer protocol to transfer file between local and remote ftp hostname workstations. lzh. Before reading this list of unix commands..lharc.1 ls -l lists presence of file.

-name file. it is overwritten.1 on screen shows differences between file.2 exists.1 sorted numerically sort -r file. including files that start with ".1 that contain pattern displays contents of file.1 copies file.1 print only the lines of file.2 exists.1 displays contents of file.2.1. -name "*pattern" -print finds all files that end with pattern.2 mv file. Directory Manipulation pwd cd dir.1 on default laser printer Show list of available printers and questions to direct your printing of a file lpr to a particular printer print size (in kilobytes) of current directory (".1 on screen. -print find .").1 -exec rm '{}' '.1 on screen show last 20 lines of file.1 is removed remove file.1 to file.1 on screen show contents of file. -name file.2 counts lines. and characters in file file.1 print file.1 is not removed moves file.Z restore the compressed file file.1 diff file.1 in the directory and sub-directories.2. No utilities exist to retrieve it print all lines that contain PATTERN in file.1 prints size (in kilobytes) of file.1 into jot for editing show contents of file.1 tail file. This compress file.1 and file. Variations: find .1 file. Variations: du -sk du -sk * prints sizes (in kilobytes) of all files and sub-directories du -sk file. Original file.1 grep PATTERN file. grep pattern file.1 cat file.1 wc -w counts words in file file.1 displays contents of file.1 ls -a lists contents of current directory. reads file. Variations: wc -l counts lines in file file. words.1 to file.2 wc cp file.1 sorted alphabetically.' removes all files named file.1 .1 lpr file.1.1 file.Z find the loation of file.2 rm file.1 sort -n file.1 wc -m counts characters in file file.1 more file.1 reduce the size of file.1 and replace it with a file named file.1 find . but doesn't scroll past top of screen show first 20 lines of file.1.Z." opens jot editor.1. it is overwritten.1 sorted alphabetically in reverse order.1.1.1 file. uncompress file. If file. Variations: sort file.1 compressed file is NOT a (readable) ASCII file.1 head file. Original file. If file.1 show the directory that you are in (present working directory) change directory to dir.

and each user belongs to a group.1 shows PRESENCE of dir.1 Process Control command1& ps -ef kill pid1 <control-c> <control-z> jobs kill %1 top osview execute command1 in background print expanded list of all processes remove process pid1 interrupt current process suspend current process display background and suspended processes remove suspended process #1 display the current.1 (and its contents) to dir.1 to dir.1 rm -r dir. The user assigns a type of privilege to each file and directory owned by the user.1 show sum of size (in kilobytes) of dir.1 remove EMPTY directory dir. as indicated by the middle "-" character.1 du -sk dir.1 make new directory dir. By default.2 move file.1 remove directory dir. users own their home directory (the current directory when the user logs in) and the contents of the home directory. By default.1 dir. The first three characters of rwxr-xr-x indicate that the owner can read. as indicated by the last "-" character. The last three characters indicate that everyone else on the system can read and execute the file (or directory). Most other files and directories are owned by "root" and other special users. write. Variations: ls ls dir. . Each file and directory is owned by a user.mkdir dir.2 mv file.1 dir.1 and it's contents in file file. and execute the file (or directory).1 ls -d dir.1 show contents of current directory. but cannot write onto the file (or directory).1.1 shows contents of dir. but cannot write onto the file (or directory).1 and its contents tar -cvf dir. the privilege is rwxr-xr-x.tar dir. most computer-intensive commands display the operating system statitistics System Security The following mechanism is the ONLY guaranteed method of protecting your work.1 rmdir dir.1 cp -r dir.2 AND its contents copy dir.1 store an image of dir. The middle three characters indicate that all other users in the same group as the owner can read and execute the file (or directory).

1 chown o-x file.. C. .pdb to /usr/people/mpagel/pdb/ by typing: cp .001 and temporary.". Text on the screen can be highlighted by sweeping the mouse cursor over the text while pressing and holding the left mouse button. if the current directory is /usr/people/mpagel. file* specifies all files and sub-directories that start with "file" and have 0 or more extra characters. I can copy the file /usr/people/huffman/Crambin. If I type mv file..1 chown g-x file.stuff. history !! !32 !mor shows list of last 100 commands repeats last command repeats command #32 in the history list repeats last command starting with "mor" G.1 chown g+w file. if the current directory contains the files template. and the parent directory of the current directory can be specified as ". regardless of the mouse cursor position (as long as the mouse cursor remains in the window).1 chown u-w file. E.1 chown o-w file.1 dir. Note that if I type: more temp<Esc> then the workstation will NOT complete the file name. For example. then I can type: more templ<Esc> and the workstation will complete the name template. and the "1" in dir.1 chown u+x file.2 to dir.1 does NOT change. which does the following command: mv file.1 chown g-w file.1 chown o+w file. For example.001. B. the workstation will complete the name for you. *file* specifies all files and sub-directories that contain the string "file" anywhere in their name.1 chown u+w file.1 chown g+r file. fi*le specifies all files and sub-directories that start with "fi" and end with "le".1 chown u-r file.1 chown o+r file. The current directory can be specified as ". If you type the first part of the name of a file or sub-directory in the current directory and then hit the <Esc> escape key. with 0 or more extra characters. since I have not specified enough characters to unambiguously specify template.1 to move file.1 chown o+x file.To change the owner's permissions of a file (or directory). This text can be inserted at the command line by clicking the center mouse button.pdb .1 chown g-r file.1 by typing ^1^2.1.2 dir.1) changes.1 To change the group's permissions of a file (or directory)./huffman/Crambin. file? specifies all files and sub-directories that start with "file" and have one extra character.1.". the owner can type: Typing Shortcuts A.001 instead of temporary. Note that the only the first "1" (in file. the owner can type: chown u+r file.1 chown u-x file.stuff./pdb/ D. F. then I can move file. the owner can type: To change the permissions of a file (or directory) for everyone else.1 chown g+x file.1 to dir.1 chown o-r file.

and almost all commands. This character is located on the key just above the <Enter> key on the SGI keyboard (you mut also hold down the <shift> key). Uppercase and lowercase matter. appears in italics. ps -ef | grep biosym first creates a list of processes (ps -ef) and then filters this list to show all lines that contain "biosym" (grep biosym).1 and dir. or a Macintosh. command2 pid1 type 'Ctrl' and 'x' keys at the same time files named file. listed by typing ps -ef Files. can also be specified using ONLY it's name regardless of your current directory. dir. directories.pdb. so be cautious. then I can type Crambin. or PPP without a terminal. When I need help. For example. These commands (mostly) work with my C-shell account on RAIN. The pipe character is used to direct the output of one command into the input of a second command. Text for which the user substitutes the name of a file. and they don't know what it is. so I can remember.2 dir. For example ls -la specifies the LONG listing of ALL directory contents. or command exists in the current directory. but I'm comfortable with basic commands and occasionally type "rm" at my DOS prompt instead of "del". For example.2 commands named command1 and command2 process ID. command. because they exist in special directories of the system. For example. subdirectory. Something is happening. especially if your prompt ends with a "$" (Korn shell) rather than a "%". file. so I've been learning some Unix. I reach for the books UNIX in a Nutshell (O'Reilly) and Unix Unbound by Harley Hahn (Osborne/McGraw Hill. Many modifiers can be combined in any order in one command. This is my Unix cheat sheet. or an ISP's menu without the Unix prompt are at a disadvantage. If the file. I. I'm no wizard. 1994). etc.2 directories named dir.1 and file.2 command1. The Net is a Unix place.1.1. Many commands have 'modifiers'.. if the current directory is /usr/people/huffman/pdb/. <control-x> file. Your account might be different.pdb to specify this file. and commands can be specified without ambiguity by using the full pathname. it can be specified using ONLY it's name. ls -l has a modifier "-l" which specifies that the LONG listing of the directory contents should be printed. Some special files and directories. I like to know what's really going on. Treebeard's Unix Cheat Sheet People who use Windows without DOS. directory. Abbreviations Used in this Guide Text that appears on the screen is highlighted in bold. The "|" character is called the PIPE character. . such as /usr/people/huffman/pdb/Crambin.H.

Careful! Show where you are as full path. or use with ncftp. There must be a space between. Most of this is available in a text version. or use with ncftp. (Not on RAIN?) It's ok to combine attributes. List a directory ls {path} ls {path_1} {path_2} ls -l {path} ls -a {path} ls -F {path} ls -R {path} ls {path} > {filename} ls {path} | more dir {path} Change to directory cd {dirname} cd ~ cd .This page won't look right without table support. eg ls -laF gets a long listing of all files with types. Append newfile to end of oldfile. Redirect directory to a file. List both {path_1} and {path_2}. including important . copy directory and all subdirs. eg apropos file. "/" = directory. Go back one directory. Show listing one screen at a time... with all subdirs. "*" = files that don't otherwise show. . Redirect help to a file to download. Go back to home directory. Long listing. Give short description of command. Useful alias. like "cd . (Not on RAIN?) Search for all Unix commands that match keyword. Useful if you're lost or exploring. with date. Show type of each file. size and permisions. Help on any Unix command. Useful alias for DOS people. useful if you're lost. RTFM! man {command} man {command} > {filename} whatis {command} apropos {keyword} Type man ls to read the manual for the ls command. cdup Make a new directory mkdir {dirname} Remove a directory rmdir {dirname} rm -r {dirname} Only works if {dirname} is empty.". Recursive listing. Show all files. Print working directory pwd Copy a file or directory cp {file1} {file2} cp -r {dir1} {dir2} cat {newfile} >> {oldfile} Recursive. Remove all files and subdirs.

cat > {filename} pico {filename} Compare two files diff {file1} {file2} sdiff {file1} {file2} Other text commands grep '{pattern}' {file} sort {file1} > {file2} sort -o {file} {file} spell {file} . "*" is any string of characters.. Good strategy: first list a group to make sure it's what's you think. Delete a file rm {filespec} ls {filespec} rm {filespec} ? and * wildcards work like DOS should. -b = binary. (Use sx with xmodem. Display misspelled words.. Use text editor and don't save.. Create some text and save it. Go talk to your spouse while it does it's stuff. vi and emacs are also available. pico {filename} Create a text file. Download with zmodem sz [-a|b] {filename} sz *. Very handy with ncftp. Like more. so you already know it. Use binary for everything. Show the differences. .zip Upload with zmodem rz [-a|b] (filename} View a text file more {filename} less {filename} cat {filename} cat {filename} | more page {filename} pico {filename} Edit a text file. Replace file with sorted version. Works fine with multiple files.. (It's the default?) Handy after downloading with FTP. View file one screen at a time. "?" is any character.) Give rz command in Unix. with extra features.then delete it all at once. Find regular expression in file. View file.Move (or rename) a file mv {oldfile} {newfile} mv {oldname} {newname} Moving a file and renaming it are the same thing. View file one screen at a time. THEN start upload at home. Show files side by side. Sort file1 and save as file2. (Use rx with xmodem. The same editor PINE uses. but it scrolls.) -a = ascii. Enter your text (multiple lines with enter are ok) and press control-d to save.

Find files on system find {filespec} find {filespec} > {filename} Make an Alias alias {name} '{command}' Wildcards and Shortcuts * ? [.cshrc file. page2. eg ls .txt Get input from file1.] ~ . and page3. and rm -r ~ will destroy it.wc {file} Count words in file. page10. eg page? gets page1 and page2. Pipe one command to another.. One directory up the tree. the group (?). eg sort < old.. eg ls | more gets directory and sends it to more to show it one page at a time. eg page* gets page1. and write to file2. More useful in your . Pipes and Redirection {command} > {file} {command} >> {file} {command} < {file} {command} < {file1} > {file2} {command} | {command} Permissions. Handy for snooping. Think of each digit as a sum: execute permission write permission write and execute (1+2) read permission =1 =2 =3 =4 . and the world (everyone else). Match any string of characters. Append output to an existing file. Get input from a file. Works with wildcards. Permissions are granted or withheld with a magic 3-digit number. Match any characters in a range.txt. The three digits correspond to the owner (you).txt > new.. and execute it.txt and saves as new. The current directory.) Redirect output to a file. Can be big! Put the command in 'single quotes'.txt sorts old. write to it. eg sort < file. but not page10.. eg cd ~ will take you home.txt writes directory to file. eg cat update >> archive adds update to end of archive. Short for your home directory. Redirect find list to file. eg page[1-3] gets page1. .txt. (You pipe a command to another command. and redirect it to a file. and page. eg ls > list. Match any single character.. important and tricky! Unix permissions concern who can read a file or directory.

and execute. write. Good for web pages. Usenet. Easy text editor. Start Telnet session to another host. You can read. one digit each for the owner. Chat with someone else online. Email. Do it on the server to reduce download size about 1/3. the world chmod 700 {filespec} can't. Give read and write permission to everyone. and the world. and your public_html directory. Good chmod 600 {filespec} for files. Find out what someone's up to. write and execute (4+2+1) =7 Add the number value of the permissions you want to grant each group to make a three digit number. the world can only chmod 644 {filespec} read. but not available on RAIN. Here are some useful combinations. the world can chmod 755 {filespec} read and execute. Text-based Web browser. Check your disk usage and show bytes in each Applications I use finger {userid} gopher irc lynx ncftp pico {filename} pine telnet {host} tin uudecode {filename} uuencode {filename} ytalk {userid} System info date df du . Better FTP. write. You can read and write. Permissions. Please use w first so you don't interrupt a big download! Show date and time. vi and emacs are available. and execute. but limited. You can read. the world can't. fast and lean. Try to figure them out! You can read and write. Good for programs you want to share. another way You can also change file permissions with letters: u = user (yourself) r = read chmod u+rw {filespec} chmod u+x {filespec} chmod a+rw {filespec} g = group a = everyone w = write x = execute Give yourself read and write permission Give yourself execute permission. IRC. Good for and execute (4+1) =5 read and write (4+2) =6 read. Gopher. eg ytalk mkummel. Check system disk capacity. the group.

. Just remember that if you make an alias with the name of a Unix command.. Check your total disk use. The single quotes tell Unix that the enclosed text is one command. It will be effective when you start.html ^ user permission (rwx) date and time last modified group permission (rwx) world permission (rwx) How to Make an Alias An alias lets you type something simple and do something complex.more /etc/motd printenv quota -v uptime w directory.file d directory. It's a shorthand for a command. Read message of the day. Who's online and what are they doing? Unix Directory Format Long listings (ls -l) have this format: . Find out system load.1 mkummel ^^^ ^^^ ^^^ * executable file size (bytes) file name / directory ^ ^ ^ 2560 Mar 7 23:25 public_html/ 10297 Mar 8 23:42 index.cshrc and look for the alias section and add what you want. Here are a few aliases from my . If you want to type "dir" instead of "ls -l" then type alias dir 'ls -l'. You can do this by adding the alias to your . ^ symbolic links (?) ^ ^ drwxr-xr-x 11 mkummel -rw-r--r-.cshrc file so they're automatically loaded when you start. Show all environmental variables (in C-shell% use set in Korn shell$). that command will become unavailable. "motd" is a useful alias.cshrc file: # enter your aliases here in the form: # alias this means this alias alias alias alias alias alias alias alias h m q bye ls dir cdup motd history more quota -v exit ls -F ls cd . more /etc/motd How to Make a Script . Aliases are more useful if they're permanent so you don't have to think about them. Type pico .

important! my lynx setup for WWW. They initialize your shell and the programs you use.login . Unix can't rename a bunch of files at once the way DOS can. my list of subscribed newsgroups.ncftp/ .bat file in DOS. Dotfiles (aka Hidden Files) Dotfile names begin with a ".bat in DOS and . login init.history . You might have a bunch of .htm files that you want to rename as . (It's a feature!) Unix is just being more consistent than DOS. rc means "run commands".A Unix script is a text file of commands that can be executed. to show that it's executable.addressbook . my pine setup for email.htm files to *. Unix contains a powerful programming language with loops and variables that I don't really understand. Change to a directory with .cshrc . hidden dir of ncftp stuff.lynxrc . list of past commands.html foreach f ( *.ini files in Windows. The first line is special. my C-shell startup info.htm ) set base=`basename $f . and it will do its stuff. These are all text files that can be edited. Some of these dotfiles are crucial. Type ls -la in your home directory to see what you have.gopherrc . but Unix makes you do it one by one.htm files and type ~/htm2html.html files. It tells Unix what program or shell should execute the script. like autoexec.pinerc my email addressbook. #! /bin/csh # htm2html converts *. Think about scripts whenever you find yourself doing the same tedious thing over and over. Make backups first! Here's some of what I get when I type ls -laF: . but change them at your peril. Then make it user-executable by typing chmod 700 htm2html.newsrc . This is actually not a defect." These files and directories don't show up when you list a directory unless you use the -a option. Other # lines are comments.htm` mv $f $base. So make a script! Make a text file (eg with pico) with the following lines. This is a problem if you develop Web pages on a DOS machine and then upload them to your Unix Server. so they are also called hidden files. like a . important! my gopher setup. . After this a * will appear by the file name when you ls -F. Here's a useful example.html end Save this in your home directory as htm2html (or whatever).

my ytalk setup. ok to edit.profile . my signature file for mail and news. DOS cd attrib comp copy del rd dir edit set find help md move ren date. just hit the "Tab" key twice and say yes. A standard unix operating system lists currently thousands of commands. time chkdsk type type filename | more sort UNIX cd chmod diff cp rm rmdir ls pico printenv grep man mkdir mv mv date df cat more sort DOS and UNIX commands Action change directory change file protection compare files copy file delete file delete directory directory list edit a file environment find string in file help make directory move file rename file show date and time show disk space show file show file by screens sort data Unix commands Note that there are thousands of commands available on a typical unix box. In bash. The following list contains some of the more frequently used programs.tin/ . ok to edit.signature .ytalkrc text appears when I'm fingered. to display the the commands currently available on your machine. important! text appears when I'm fingered.. . Korn shell startup info.plan . hidden dir of my tin stuff for usenet. ok to edit. Type x to list all commands starting with x.project .

set terminal options Communications mail .generate lexical analysis programs lint .pop the directory stack (C shell only) pushd .change disk quota on ACITS UNIX systems chsh .check C source code make .source-level debugging program f77 .look up user information history .suspend current process Status Information clock .talk to another logged-in user write .echo arguments pbm .suspend process at next input request ^z .show network status rsh .determine processor time date .symbolic mathematics program nice .bring process into foreground jobs .clear terminal screen echo .send and receive mail talk .) passwd .change default login shell clear .assembler.define synonym commands chquota .set an environment variable (C shell only) stty .summarize disk space used env .C compiler csh .make typescript of terminal session setenv .kill a process ld .list processes ^y .sign a command immune to Process Control bg .summarize free disk space du .show date and time df .write to another logged-in user News/Networks netstat .C shell command interpreter dbx .change login password rlogin .display environment finger .maintain large programs maple . specific to each machine architecture awk .permit or deny terminal messages and talk requests pine .run a command at low priority (see "man nice" or "man csh") nohup .put suspended process into background fg .push directory on stack (C shell only) script .secure shell slogin .change login password in yellow pages Miscellaneous alias .Access Control exit .run shell or command on another UNIX system ssh . end session (C shell and bash shell only.send and receive mail mesg .list previously issued .secure-shell version of rsh Programming Tools as .portable bitmap manipulation programs popd .Fortran compiler gdb .online calculator cc .pattern scanning and processing language bc .symbolic mathematics program math .GNU Project debugger gprof .the UNIX loader lex .display profile of called routines kill .secure version of rlogin yppasswd .log in remotely to another UNIX system ssh .terminate a shell (see "man sh" or "man csh") logout .

find . or ksh) spend .graphical calulator under x Documentation apropos .set terminal options time .start the info explorer program man .photoshop type image processing program xfig . bash.mpg player realplay .full-screen text editor vim .print out environment ps .copy files crypt . how long system has been up w .who owns the shell emacs .change group of a file or directory cmp .encrypt/decrypt files (CCWF only) diff . what command each job is executing who .lists year-to-date ACITS UNIX charges stty .select/reject lines common to two sorted files cp .compare two files comm .paint program kpaint .show who is logged onto the system whois .timing programs top .set shell variables (C shell.screen-oriented text editor (renamed called nano) sed .realaudio player timidity .determine file type grep .scan picture xpaint .compress or expand files ln .show search path for man pages printenv .list top cpu processes uptime .display profile data python .stream-oriented text editor vi .locate commands by keyword lookup find .Bourne shell command interpreter yacc .drawing program xv .Python programming language sh .kde paint program File and Directory Management cd .show system load.change owner (or group) of a file or directory chgrp .search a file for a pattern gzip .compare the contents of two ASCII files file .print full pathname of working directory set .Popular script interpreter prof .full-screen text editor ("viimproved") Image Processing gimp .locate source.mp3 player Text Processing abiword .image viewer xvscan .show who is on system.change the protection of a file or directory chown .locate file (i.tex -print) info .Internet user name directory service whoami .e.indicate last login of users lpq .examine spool queue manpath .midi to wav converter and player xmms .generate input parsing programs xcalc .Pascal compiler (xlp on ADS) perl .screen-oriented text editor pico .find manual information about commands whatis .make a link to a file Sound mplayer .show process status pwd .create or extend bibliographic . or man page for a program Editors commands last .change working directory chmod .open source word processor addbib .hangups pc . -name *. binary.describe what a command is whereis .

display a file.change default file protections uncompress .show print.mark differences between files dvips .analyze surface characteristics of a document tbl .create or extract archives tee .grab window (i.remove jobs from the printer spooling queue more .fold long lines to fit output device head . last access) sync .make cross-reference listing of nroff/troff macro files ndx .make permuted index (not on CCWF) refer .create a directory mv .display a compressed file xv .show the last part of a file zcat .latex with pdf output latex2html . one screen at a time less .e.format tables for nroff/troff tex .report (or delete) repeated lines in a file wc . "1152x864" 51.count lines.format text for simple display pic .identify wordy sentences diffmk .examine the printer spooling queue lpr .make simple pictures for troff input psdit .list the contents of a directory lsof .ppm) xdpyinfo .e.find hyphenated words ispell .pic preprocessor for drawing graphs hyphen .format text tpic .sort or merge files tar .like "more".find spelling errors ispell .like more with more features page .translate characters umask .format text in LaTeX (based on TeX) pdfelatex .show first few lines of a file lpq .convert pic source files into TeX commands wget .delete (remove) directories stat . but prints screens top to bottom pr .status of file (i.interactive spell checker style .move or rename files and directories pwd .restore compressed file uniq .info on screen: i.kill xwindow xlock .list of open files mkdir .format mathematics with nroff nroff .print a file lprm .sort bibliographic database spell .Latex to html lookbib .59Hz import .find bibliography references macref .convert TeX DVI files into PostScript explain .xterminal File Transfer .ls . manipulate images gv . catenate files fold .number of colors xkill .filter reverse line feeds diction .paginate a file for printing tail .e.grab webpage X windows grabmode .run off bibliographic database sortbib .delete (remove) files rmdir .show ps and pdf files xpdf = shopw pdf files (use gv) database col .213kHz/56.check spelling interactively latex .flush filesystem buffers sort .copy input to standard output and other files tr .filter troff output for Apple LaserWriter ptx .create a subject-page index for a document neqn .explain phrases found by diction program grap . the full pathname of your working directory quota .insert references from bibliographic databases roffbib .show the contents of a file.lock screen xterm .display disk usage and limits rm . import ppm:>out. and characters in a file File Display and Printing cat .

xwininfo - information on open window

ftp - transfer files between network hosts rsync - fast and flexible sync between computers scp - secure version of rcp html2ps - html to ps latex2html - latex to html translator lynx - text based webbrowser netscape - webbrowser sitecopy - sitecopy is for easily maintaining remote web sites. weblint - html sytax and style checker

Command a2p ac alias ar arch arp as at awk basename bash bc bdiff bfs bg biff break bs bye

Description Creates a Perl script from an awk script. Prints statistics about users' connect time. Create a name for another command or long command string. Maintain portable archive or library. Display the architecture of the current host. Manipulate the system ARP cache. An assembler. Command scheduler. Awk script processing program. Deletes any specified prefix from a string. Command Bourne interpreter Calculator. Compare large files. Editor for large files. Continues a program running in the background. Enable / disable incoming mail notifications. Break out of while, for, foreach, or until loop. Battleship game. Alias often used for the exit command.

cal calendar cancel cat cc cd chdir checkeq checknr chfn chgrp chkey chmod chown chsh cksum clear cls cmp col comm compress continue copy cp cpio crontab

Calendar Display appointments and reminders. Cancels a print job. View and/or modify a file. C compiler. Change directory. Change directory. Language processors to assist in describing equations. Check nroff and troff files for any errors. Modify your own information or if super user or root modify another users information. Change a groups access to a file or directory. Change the secure RPC key pair. Change the permission of a file. Change the ownership of a file. Change login shell. Display and calculate a CRC for files. Clears screen. Alias often used to clear a screen. Compare files. Reverse line-feeds filter. Compare files and select or reject lines that are common. Compress files on a computer. Break out of while, for, foreach, or until loop. Copy files. Copy files. Creates archived CPIO files. Create and list files that you wish to run on a regular schedule.

csh csplit ctags cu curl cut date dc df deroff dhclient diff dig dircmp dirname dmesg dos2unix dpost du echo ed edit egrep elm emacs enable env eqn

Execute the C shell command interpreter Split files based on context. Create a tag file for use with ex and vi. Calls or connects to another Unix system, terminal or non-Unix system. Transfer a URL. Cut out selected fields of each line of a file. Tells you the date and time in Unix. An arbitrary precision arithmetic package. Display the available disk space for each mount. Removes nroff/troff, tbl, and eqn constructs. Dynamic Host Configuration Protocol Client. Displays two files and prints the lines that are different. DNS lookup utility. Lists the different files when comparing directories. Deliver portions of path names. Print or control the kernel ring buffer. Converts text files between DOS and Unix formats. Translates files created by troff into PostScript. Tells you how much space a file occupies. Displays text after echo to the terminal. Line oriented file editor. Text editor. Search a file for a pattern using full regular expressions. Program command used to send and receive e-mail. Text editor. Enables / Disables LP printers. Displays environment variables. Language processors to assist in describing equations.

Exit from a program. commands previously entered to an interactive sh. Lists information about the user. Simple text formatters. Tells you if the object you are looking at is a file or if it is a directory. Shell built-in functions to repeatedly execute action(s) for a selected number of times. Enables a super user or root to remove a group. Evaluate arguments as an expression. Converts text files between DOS and Unix formats. Enables ftp access to another terminal. Shell built-in functions to repeatedly execute action(s) for a selected number of times. List info about machines that respond to SMB name queries on a subnet. Expand copies of file s. shell or log you out of a Unix network. Check and repair a Linux file system. Enables a super user or root to modify a group. Creates a new group account. Continues a stopped job by running it in the foreground Search a file for a fixed-character string. . Filter for folding lines.ex exit expand expr fc fg fgrep file find findsmb finger fmt fold for foreach fromdos fsck ftp getfacl gprof grep groupadd groupdel groupmod gunzip gview Line-editor mode of the vi text editor. Display discretionary file information. Finds text within a file. A programmers text editor. Expand compressed files. The gprof utility produces an execution profile of a program. Finds one or more files assuming that you know their approximate filenames. The FC utility lists or edits and re-executes.

gvim gzip halt hash hashstat head help history host hostid hostname id ifconfig ifdown ifup isalist jobs join keylogin kill ksh ld ldd less lex link ln A programmers text editor. Joins command forms together. List the jobs currently running in the background. unless otherwise stated. Opposite of the more command. Creates a link to a file. DNS lookup utility. Generate programs for lexical tasks. Displays the first ten lines of a file. Remove internal hash table. Korn shell command interpreter. Calls the link function to create a link to a file. Sets up network interfaces. Cancels a job. Set or print name of current host system. List dynamic dependencies of executable files or shared objects. Shows you the numeric user and group ID on BSD. Prints the numeric identifier for the current host. take a network interface down bring a network interface up Display the native instruction sets executable on this platform. Stop the computer. Decrypt the user's secret key. Compress files. Display the history of commands typed. Link-editor for object files. Display the hash stats. . If computer has online help documentation installed this command will display it.

Renames a file or moves it from one directory to another directory. Returns users login name. Build a Linux file system. mailx make man mesg mii-tool mkdir mkfs more mount mt mv Mail interactive message processing system. Line printer control program. . Removes print requests from the print queue. View. Lists the contents of a directory. Prints a file on System V systems. Control if non-root users can send text messages to you. Lists the status of all the available printers. Lists status of the LP print services. shell or log you out of a Unix network. Create a directory. Signs into a new system. usually a hard disk partition. Magnetic tape control. manipulate media-independent interface status. List files in databases that match a pattern. Executes a list of shell commands associated with each target.lo locate login logname logout lp lpadmin lpc lpq lpr lprm lpstat ls mach mail Allows you to exit from a program. Disconnects a file systems and remote resources. Display a manual of a command. Configure the LP print service. Logs out of a system.x compatibility for the Solaris mailbox format. Submits print requests. Display the processor type of the current host. One of the ways that allows you to read/send E-Mail. Displays text one screen at a time. mailcompat Provide SunOS 4.

but with the local environment. Formats documents for display or line-printer. Shows network status. Language processors to assist in describing equations. Shrinks file into a compressed file. Utilities for searching NIS+ tables. Install new elm aliases for user and/or system. Network exploration tool and security / port neqn netstat newalias newform newgrp nice niscat nischmod nischown nischttl nisdefaults nisgrep nismatch nispasswd nistbladm nmap nohup nroff nslookup on onintr optisa pack pagesize passwd paste TCP/IP swiss army knife. Shell built-in functions to respond to (hardware) signals. NIS+ table administration command. Change the time to live value of a NIS+ object. Display NIS+ tables and objects. Log into a new group. as returned by getpagesize. Allows you to change your password. Queries a name server for a host or domain lookup. Merge corresponding or subsequent lines of files. Execute a command on a remote system. . Utilities for searching NIS+ tables. Runs a command even if the session is disconnected or the user logs out. Change NIS+ password information. Display NIS+ default values. Change the owner of a NIS+ object. Invokes a command with an altered scheduling priority. Display the size of a page of memory in bytes. Change access rights on a NIS+ object. Change the format of a text file. Determine which variant instruction set is optimal to use.

Examine the active processes on the system and reports the process IDs of the processes Simple and very easy to use text editor in the style of the Pine Composer. Recomputes the internal hash table of the contents of directories listed in the path. Line oriented file editor. Examine the active processes on the system and reports the process IDs of the processes Stop the computer. Stop the computer. Display the internal version information of dynamic objects within an ELF file. Files perusal filters for CRTs. shell or log you out of a Unix network. Runs a command on another computer. Perl is a programming language optimized for scanning arbitrary text files. Shell built-in functions to repeatedly execute action(s) for a selected . Compresses file. Sends ICMP ECHO_REQUEST packets to network hosts. Print the current working directory. Display's or set scheduling parameters of specified process(es) Write formatted output. Allows you to exit from a program. Copies files from one computer to another computer. Command line program for Internet News and Email.pax pcat perl pg pgrep pico pine ping pkill poweroff pr priocntl printf ps pvs pwd quit rcp reboot red rehash remsh repeat Read / write and writes lists of the members of archive files and copy directory hierarchies. Reports the process status. Formats a file to make it look better when printed. extracting information from those text files.

A programmers text editor. Establish a remote connection from your terminal to a remote machine. Deletes a file without confirmation (by default). Deletes a directory. One of the ways that allows you to read/send E-Mail. Runs a command on another computer. flexible replacement for rcp. Graphically displays the system activity data stored in a binary data file by a previous sar run. Show / manipulate the IP routing table. Modify the Access Control List (ACL) for a file or files. Runs or processes jobs through the Bourne shell. Allows you to use pre-recorded commands to make changes to text. Reads newsgroups. Change file access and modification time. Convert a sed script into a Perl script. Displays the activity for the CPU. A programmers text editor. Set the value of an environment variable. Report RPC information. . Faster. Set the value of an environment variable. rgview rgvim rlogin rm rmail rmdir rn route rpcinfo rsh rsync rview rvim s2p sag sar script sdiff sed sendmail set setenv setfacl settime sftp sh A programmers text editor. Secure file transfer program. side-by-side. A programmers text editor. Sends mail over the Internet. Compares two files.number of times. Records everything printed on your screen.

Looks through a text file and reports any words that it finds in the text file that are not in the dictionary. Display file or filesystem status. Discard symbols from object files. Sorts the lines in a text file. reports process data and system activity. Used to time a simple command. . Get and set system information strings. An ftp-like client to access SMB/CIFS resources on servers. Preprocessor for formatting tables for nroff or troff. Uses the telnet protocol to connect to another remote computer. Create tape archives and add or extract files. Read from an input and write to a standard output or file. Turn off the computer immediately or at a specified time. Control process execution. Sets options for your terminal. The timex command times a command. Split a file into pieces. Waits a x amount of seconds. Set tabs on a terminal. Linux system logging utilities. Delivers the last part of the file. Talk with other logged in users. Concatenate and print files in reverse. Dump traffic on a network. OpenSSH SSH client (remote login program). Copy a magnetic tape. Become super user or another user. first overwriting it to hide its contents.shred shutdown sleep slogin smbclient sort spell split stat stop strip stty su sysinfo sysklogd tabs tail talk tac tar tbl tcopy tcpdump tee telnet time timex Delete a file securely.

. Typeset or format documents. Create a new user or updates default new user information. Reads the named filenames or terminal and does underlining.todos top touch tput tr traceroute troff ul umask unalias unhash uname Converts text files between DOS and Unix formats. Translate characters. Remove a users account. A programmers text editor. uniq unmount unpack untar until useradd userdel usermod vacation vedit vgrind vi vim view w Report or filter out repeated lines in a file. Create tape archives and add or extract files. Reply to mail automatically. Initialize a terminal or query terminfo database. Modify a users account. Print the route packets take to network host. Remove an alias. Display Linux tasks. Remove internal hash table. Execute a set of actions while/until conditions are evaluated TRUE. Show who is logged on and what they are doing. Change file access and modification time. uncompress Uncompressed compressed files. Print name of current system. Get or set the file mode creation mask. Screen-oriented (visual) display editor based on ex. Grind nice program listings Screen-oriented (visual) display editor based on ex. Expands a compressed file. Crates a file systems and remote resources. A programmers text editor.

self-paced introduction on how to use the commands listed below. Execute the X windows system. or use the man pages. for more information on grep. Contents • cat --.for creating and displaying short files . or 'y'. Compress files.wait wc whereis while which who whois write X xfd xlsfonts xset xterm xrdb yacc yes yppasswd zcat Await process completion. and characters in a file Locate a binary. yacc is a compiler. For more documentation on a command. Displays a count of lines. Repeatedly output a line with all specified STRING(s). Short for yet another compiler-compiler. Display all the characters in an X font. Internet user name directory service. Unix Command Summary See the Unix tutorial for a leisurely. and manual page files for a command. use the command man grep. Terminal emulator for X. Changes network password in the NIS database. Locate a command. Repetitively execute a set of actions while/until conditions are evaluated TRUE. words. X server resource database utility. source. consult a good book. For example. Send a message to another user. Displays who is on the system. Server font list displayer for X. User preference utility for X.

sort file tail --.connect to a remote machine to download or upload files grep --. For our first example we create a three-item English-Spanish dictionary in a file called "dict.set an environment variable sort --.change directory cp --.custom print command (see also lpr ) pwd --.• • • • • • • • • • • • • • • • • • • • • • • • • chmod --. then tap 'd'".for moving and renaming files ncftp --. words.standard print command (see also print ) more --.use to read files mkdir --. lines cat This is one of the most flexible Unix commands.especially good for downloading files via anonymous ftp.display date echo --.echo argument ftp --." % cat >dict red rojo green verde blue azul <control-D> % <control-D> stands for "hold the control key down.see what files you have lpr --.for copying files date --.change permissions cd --. To view a file we use cat in a different way: % cat dict red rojo green verde blue azul % If we wish to add text to an existing file we do this: .remove directory rsh --.display last part of file tar --.display first part of file ls --. add or extract files telnet --. print --. view and concatenate files.find out what directory you are in rm --.count file head --. We can use to create.create directory mv --.remove a file rmdir --.remote shell setenv --.create an archive. The symbol > tells the computer that what is typed is to be put into the file dict.log in to another machine wc --.

a shell script mycommand executable.001 readable by everyone. For more information on chmod.the number of characters. chmod This command is used to change the permissions of a file or directory. words. % cd english % pwd % /u/ma/jeremy/english % ls novel poems % cd novel .% cat >>dict white blanco black negro <control-D> % Now suppose that we have another file tmp that looks like this: % cat tmp cat gato dog perro % Then we can join dict and tmp like this: % cat dict tmp >dict2 We could check the number of lines in the new file like this: % wc -l dict2 8 The command wc counts things --. and line in a file. For example to make a file essay. Use pwd to see what directory you are in. e. we do this: % chmod a+r essay.001 To make a file. cd Use cd to change directory.g.. % chmod +x mycommand To check the permissions of a file. use man chmod. we do this Now we can run mycommand as a command. use ls -l .

then went to his english subdirectory.. cp Use cp to copy files or directories. % date Fri Jan 6 08:52:42 MST 1995 echo The echo command echoes its arguments. found that it contained two entries. The symbol "~" stands for the home directory. to jump back one level. % cp ~/poems/jabber . then go to poems he could have said cd .. If had wanted to jump back one level. Finally he used cd with no argument to jump back to his home directory. % cp foo foo. Here are some examples: % echo this this % echo $EDITOR /usr/local/bin/emacs % echo $PRINTER b129lab1 . He cd'd to the diretory novel.." stands for the current directory. Then he used cd .% pwd % /u/ma/jeremy/english/novel % ls ch1 ch2 ch3 journal scrapbook % cd . both of which happen to be diretories./poems. date Use this command to check the date and time. and found that he had gotten only as far as chapter 3 in his writing. This makes a copy of the file foo. He listed this directory using ls . % pwd % /u/ma/jeremy/english % cd poems % cd % /u/ma/jeremy Jeremy began in his home directory. The symbol ".2 This copies the file jabber in the directory poems to the current directory.

Name (solitude:carlson): jeremy 331 Password required for jeremy. ftp> put collected-letters ftp> quit The ftp program sends files in ascii (text) format unless you specify binary mode: ftp> ftp> ftp> ftp> binary put foo ascii get bar . Password: 230 User jeremy logged in. The dollar sign before an environment variable is needed to get the value in the This one stores the name of the default printer --. Try the following to verify this: % echo PRINTER PRINTER ftp Use ftp to connect to a remote machine.4(11) Mon Apr 18 17:26:33 MDT 1994) ready. 220 then download the file homework11: % ftp solitude Connected to FTP server (Version wu-2. See also: ncftp Example 1: We'll connect to the machine fubar. then change director to mystuff. ftp> cd mystuff 250 CWD command successful. 220 fubar.4(11) Mon Apr 18 17:26:33 MDT 1994) ready. then upload the file collected-letters: % ftp solitude Connected to fubar.Things like PRINTER are so-called environment variables.the one that print jobs will go to unless you take some action to change things. then change director to mystuff. Name (solitude:carlson): jeremy 331 Password required for jeremy. then upload or download files. ftp> get homework11 ftp> quit Example 2: We'll connect to the machine fubar. ftp> cd mystuff 250 CWD command FTP server (Version wu-2. Password: 230 User jeremy logged

Grep can also be combined with other commands. consult % man grep head Use this command to look at the head of a file. % grep Fred ph | sort Alpha.001 . % head essay. This is because "brown" is not in our dictionary file. For example. % grep red dict red rojo % grep blanco dict white blanco % grep brown dict % Notice that no output was returned by grep brown. Fred: 333-6565 Beta. Freddie: 656-0099 Frederickson. Molly: 444-0981 Gamma. the file bar was transferred in ascii mode. grep Use this command to search for information in a file or files. if one had a file of phone numbers named "ph".The file foo was transferred in binary mode. suppose that we have a file dict whose contents are red rojo green verde blue azul white blanco black negro Then we can look up items in our file like this. Frederick: 431-0987 The symbol "|" is called "pipe." It pipes the output of the grep command into the input of the sort command. then the following command would give an alphabetical list of all persons whose name contains the string "Fred". For more information on grep. one entry per line. For example. For example. Fred-George: 111-7676 Zeta.

Your files are kept in something called a directory.001 ls Use ls to see what files you have.displays the first 10 lines of the file essay. There are some useful variants of the ls command: % ls l* letter1 letter2 letter3 % Note what happened: all the files whose name begins with "l" are listed. It matches any string. lpr This is the standard Unix command for printing a file. % head -n 20 essay. do this: % ls % cd essays % mkdir essays .001 To see a specific number of lines. do this: This displays the first 20 lines of the file. mkdir Use this command to create a directory. See print for information on our local intelligent print command. It stands for the ancient "line printer. % ls foo foobar letter1 % letter2 letter3 maple-assignment1 Note that you have six files. do To see what files are in essays." See % man lpr for information on how it works. The asterisk (*) is the " wildcard" character. To get "into" this directory.

read next line b --. It probably will not fit in one screen. we could do this: % more poems The effect of this to let you read the file "poems ". since you just made it.There shouldn't be any files there yet.quit more spacebar --. To create files.fubar. For > get jokes. print This is a moderately intelligent print command. Here are the basic commands: • • • • q --. more More is a command used to read text files. % ncftp next page return key --. % mv foo foobar The file that was named foo is now named foobar ncftp Use ncftp for anonymous ftp --.go back one page For still more information.txt is downloaded from the machine ftp.that means you don't have to have a Connected to ftp.fubar. use the command man .txt The file jokes. so you need to know how to "turn pages".fubar. % print foo % print see cat or emacs. mv Use this command to change the name of file and directories.

regardless of whether the file is a text file (like foo ). In these examples the file is printed on the default printer. To print on a specific printer. Then he cd 'd into his homework subdirectory. rm Use rm to remove files from your directory. do and read the message displayed. a postcript file (like jwb321 % print manuscript. % rm foo remove foo? y % rm letter* remove letter1? y remove letter2? y remove letter3? n % . % pwd /u/ma/jeremy % cd homework % pwd /u/ma/jeremy/homework % ls assign-1 assign-2 assign-3 % cd % pwd /u/ma/jeremy % Jeremy began by working in his "home" directory. or a dvi file (like manuscript. do this: pwd Use this command to find out what directory you are working in.dvi. Cd means " change directory".% print manuscript. Then he cd'd back to his home directory.dvi jwb321 % setenv PRINTER jwb321 % print To change the default printer. do this: % print foo jwb321 % print notes. (They were). To see what this then used ls to see if all his homework files were there. He used pwd to check to make sure he was in the right place.dvi In each case print does the right thing.

To empty a directory. our user (Jeremy?) decided not to remove letter3. to remove a directory called "essays". One reason to do this is that the remote machine might be faster. The second command was intended to remove all files beginning with the string "letter. use rm. rmdir Use this command to remove a directory.The first command removed a single file." However. suppose we have a file dict with contents red rojo green verde blue azul white blanco black negro Then we can do this: . For example. See also: telnet setenv % echo $PRINTER labprinter % setenv PRINTER myprinter % echo $PRINTER myprinter sort Use this commmand to sort a file. For example. rsh Use this command if you want to work on a computer different from the one you are currently working on. For example. This is one of our public workstations and is fairly fast. do this: % rmdir essays A directory must be empty before it can be removed. the command % rsh solitude connects you to the machine solitude.

do this: % telnet solitude See also: rsh. Example: % tar -tvzf foo. % sort dict >dict.Here the output of sort went to the screen. % tail -n 20 essay. % tar -xvzf foo.gz telnet Use this command to log in to another machine from the machine you are currently working on. To store the output in file we do this: You can check the contents of the file dict. For example. or emacs . do this: This displays the last 20 lines of the file.001 tar Use create compressed archives of directories and files.sorted % sort dict black negro blue azul green verde red rojo white blanco tail Use this command to look at the tail of a file. % tail essay. more . . For example.tar. and also to extract directories and files from an archive.tar. to log in to the machine "solitude".gz while extracts the files.001 To see a specific number of lines.tar.gz displays the file names in the compressed archive foo.001 displays the last 10 lines of the file essay.sorted using cat .

and 56 characters.c . Unix operating systems comes with online manual system which can be used to see the command details . enter the command ls *. Following are a few of the most popular and useful commands used in unix operating system wildcard characters * The * wildcard character substitutes for one or more characters in a filename. syntax options and examples on while working on a unix system.wc Use this command to count the number of characters. that we have a file dict with contents red rojo green verde blue azul white blanco black negro Then we can do this % wc dict 5 10 56 tmp This shows that dict has 5 lines. 10 words. to list all the files in your directory that end with . Unix manual can be accessed using man <command name> and it requires the man package installed and MANPATH set to man directories. as illustrated below: % wc -l dict 5 tmp % wc -w dict 10 tmp % wc -c dict 56 tmp dummy Under construction Basic Unix Commands Unix commands are the first thing needed by a unix sysadmin who are starting to work in unix operating system .c. Suppose. For instance. The manual page directories may differ in different unix operating systems and man package may not be installed in all systems . words. The word count command has several options. and lines in a file. for example.

file filename . dirname (wildcard character/s supported) or cp directory/oldfile . text .vi full screen editor ed . filename with wildcard character/s. the Unix command: ls prog? dir Change Make Move Remove cd dir mkdir dir Change to directory d Create new directory d mv dir1 dir2 Rename directory d1 as d2 rmdir dir Remove directory d file list . file command tries to determine the file type . prog2. word. Opens a existing file or creates Text content display . details move to directory copy file to other/current directory Delete the file file ls filename . prog3. File edit/create/view vi . For instance. filename .? ? (question mark) serves as wildcard character for any one character in a filename. no details only names list . and prog3 in your directory. ls -1 mv filename cp file directory/newfile rm file .file1 & cat file1 file2 >file3 file2 into file3 File operation Change chmod mode file . & char vi filename ed filename wc filename .Line Text editor count .Line. executable etc after comparing the values in /etc/magic .List contents of file at cat filename once Text content display by screen : List more filename contents of file screen by screen Concatenate . filename with wildcard character/s. if you have files named prog1.Recursively remove files & directly without any warning. rm -rf directory .

read/write/execute mode of fil chown Remove Compare two files Sort Alphabetically Sort Numerically Split f into n-line pieces match pattern head f Output beginning of file Output end of file chown [-R] [-h] owner[:group] file Rename file file1 as file2 rm file Delete (remove) file f cmp file1 file2 sort file sort -n file split [-n] f grep pattern file Outputs lines that move (rename ) file mv file1 file2 Copy file file1 into file2 cp file1 file2 Lists file differences diff file1 file2 head file tail file PROCESS Suspend current process Interrupt processes Resume screen scrolling Sleep for n seconds Print list of jobs Kill job n Remove process n status process status stats Resume background job n Resume foreground job n Exit from shell CTRL/z * CTRL/c * Stop screen scrolling CTRL/s * CTRL/q * sleep n jobs kill % kill -9 n ps bg [%n] fg [%n] exit User admin add a new user login to the system # useradd -u 655 -g 20 -d /home/ttes testlogin loginname -u is userid . . if not specified system takes highest available .

. #useradd testlogin default values .Remove alias passwd <user> alias name1 name2 alias name1="name2" unalias name1[ login name to be created . -d home directory . if not specified other or user is assigned. export makes variable visible in sub shells. it is used to set options in ksh like set -o vi export variable . sentenv name v export name=v example : export TERM=vt100 Connectivity .. default is to use user as the directory name under the home directory.] will create a user by the name 'testlogin' with all printer Output file f to line printer lp -d printer file System Status Display disk quota Print date & time List logged in users Output user information Display recent commands quota date who Display current user whoami finger [username] history Environment Variable set export Set environment variable (csh/tcsh) to value v Set environment variable (ksh/bash) to value v set command alone displays the environment variables. password Change alias (csh/tcsh) Create command alias (ksh/bash) Create alias command alias .-g group id should be existing in /etc/group . loginname .

Extract content of a tar archive tar cvf filename. TApeaRchive tar tvf filename. Securely connecting to ssh username@hostname or ssh -l username hostname Depending on ssh setting for your account you may or may not be a remote host asked a password to login. backup and restore using cpio . get .tar using file1. file2. Copy files from/to remote host ftp hostname ftp expects you to enter your username/passwd or if it is ftp only account it will require ftp account password . Router/firewall configuration may prevent ping to succeed . mget (multipleput) command is used to transfer files from remote host. Your login/passwd will be same login password as you would use with telnet connection. tar can't copy the special files . -cpio /dev/rmt/c0t0d0 --.Without argument it enters command mode (telnet>) and accepts command listed by ? at telnet> prompt.file3 .Not suitable for taking root backup. Test the tcp/ip connectivity between two hosts ping hostname If you can ping a host the host is reachable from the machine that you are using . Communication is encrypted between two hosts so if someone intercepts your communication he will not be able to use it. Backup and Restore backup and restore using tar .Copy the contents of a directory into a tape archive: #find .tar --.Connecting to a remote host $telnet hostname/ip address or $telnet Telnet brings up the login prompt of remote host and expects you to enter your user name & password . put . mput (multipleput) command is used to transfer files to remote host. Communication is not encrypted between two hosts.tar file1 file2 file3 --.copy entire directory to other place: #find .View the table of content of a tar archive tar xvf filename.Create a tar archive called filename. device files . -depth -print | cpio -pd newdir --. CopyInputOutput cpio is mostly used in conjunction with other commands to generate a list of files to be copied : #ls | cpio -o > /dev/rmt/c0t0d0 -.Copy files in current directory to a tape .tar --. ftp allows some limited number of commands to be executed at ftp> prompt & summary of ftp command can be found by using ? at ftp> prompt Securely copy files sftp username@hostname:remotefile localfile from/to remote host Communication is encrypted between two hosts.

find does not follow symbolic links.cpio can copy special files and hence useful in taking root backup containing device file. Directory Show current directory Show content of directory Changing directory Creating directory Deleting directory if empty Deleting directory if full Moving directory Copy directory :: pwd ls -al cd <newdir> mkdir <dir> rmdir <dir> rm -r <dir> mv <olddir> <newdir> cp -r <olddir> <newdir> :: ls -al <file> rm -i <file> mv <file> <path> cp <file> <newfile> mv <oldfile> <newfile> cat <file> more <file> cat <file> | fold Files Show file entry Delete file Move file Copy file Rename file Show file content at once Show file content page wise Show file with long lines . -name '*.log' -exec rm {} \.By default. of certain size etc.Simple find to list log files find . find . directories Find command is used to find the files . Please refer to man find for more option. directories find files . modified time . -. directories and to run commands on the list of files thus generated . Find files . -name *. find accepts a long list of options to find the files based on different parameters such as create time .Simple find to find log files and delete them . The following list of basic unix commandshas been compiled by Per Kistler.log -print --.

Show first 20 lines of file Show last 20 lines of file Edit file Edit file with vi Give all file permissions to yourself The above even into subdirectories Open file for reading and executing for all Starting file as program Find word in file Find all files which contain a word Find abstract pattern: ab 2 digits cd Comparing two files Updating the date of a file Giving a specific date to a file head -20 <file> tail -20 <file> <editorname> <file> vi <file> chmod 700 <file> chmod -R 700 <dir> chmod 644 <file> <filneame> <arguments> grep <word> <file> grep -l <word> * grep 'ab[0-9][0-9]cd' <file> diff <file1> <file2> touch <file> touch 0101010199 <file> :: man <command> man -k <term> which <commandname> whence <commandname> :: alias <aliasname> '<long_command>' alias <aliasneme> '<command> \!* <other>' alias <aliasname>='<long_command>' <aliasname> <arguments> \<command> alias unalias <aliasname> :: env setenv term vt100 Help Getting help about a command Find command related to a term Where is a particular program if it is in the path Is a <name> a unix command or an alias in ksh Aliases Making an alias in csh/tcsh Making an alias where the arguments go in the middle Making an alias in sh/bash/ksh Using an alias Use command instead of it's alias Showing all aliases Remove an alias Adjustments See environment variables Setting the term variable if vi doesn't work .

.. what date last -20 uname -a whoami hostname df -k quota -v du -k :: Internet Telnet to another computer Rlogin to another computer Browsing the net with netscape Check whether someone is logged in somwhere Check for all people on another computer Talk to another person on another computer Ftp building up connection Ftp adjusting for binary transfer Ftp showing directory Ftp changing directory Ftp getting a file Ftp getting multiple files Ftp searching for a file Get the ip number of a computer Check whether another computer is up Check the pathway to another computer Info about Unix System See who is logged on Get the date See who logged in lately See what operating system is there See who you are Get the name of your computer See the disk space used See you quota usage See how much space all your files need Mail .domain finger @host.domain ftp <computername> >bin >dir >cd /<path>/<path> >get <file> >mget <filenamecommon>* >quote site find <filename> nslookup <computername> ping <computername> traceroute <computername> :: who ..domain talk user@host. w .0 :: telnet <computername> rlogin -l <username_there> <computername> netscape finger user@host.Opening the X-server for X-clients Setting the display for X-clients xhost + setenv display <computer>:0..

by date. and when it was last modified. and shows where they differ wc filename --. for example to list files by size. Note that some of these commands are different on non-Solaris machines . and characters there are in a file . more filename --. mv filename1 filename2 --.see SunOS differences. You can use /pattern to search for a pattern. There are many more options. which contains lots of useful an editor that lets you create and edit a file. the exact size of the file.e. the easiest thing to do is hit CTRL-u to cancel the whole line. words. e. by typing the command and hitting return.lists all files. emacs filename --. You can make this your default by making an alias in your .Z gzip <file> gzip -d <file>.copies a file rm filename --.lists your files ls -l --.Check for mail Read mail Compose mail Mail a whole file ( one "<" is real ) from Mail Mail -s <subject> <mailaddress> Mail -s <subject> <mailaddr> < <file> :: compress <file> uncompress <file>. which will ask you for confirmation before actually deleting anything.gz Compressing Files Compress 50% Uncomress the above file. including the ones whose filenames begin in a dot.cshrc file. recursively etc. ls -a --.shows the first part of a file. See the emacs page. But you can also edit the command line (see the guide to More UNIX). Files • • • • • • • • ls --. just as much as will fit on one screen.tells you how many lines.lists your files in 'long format'. or moves it into a different directory (see below) cp filename1 filename2 --. diff filename1 filename2 --. which you do not always want to see. Just hit the space bar to see more or q to quit. UNIX is case-sensitive.Z Compress 70% Uncompress the above file.gz Basic UNIX commands Note: not all of these are actually part of UNIX itself. who owns the file and who has the right to look at it. If you've made a typo. gives it a different name. It is wise to use the option rm -i.compares files.moves a file (i.g.removes a file. But they can all be used on turing in essentially the same way. and you may not find them on all UNIX machines.

Note that for someone to be able to actually look at the file the directories it is in need to be at least executable.dvi files (i. to get the number needed for removal. but it depends very much on the size of the file and the nature of the contents.lets you look at a gzipped file without actually having to gunzip it (same as gunzip -c). and you can get back there by typing 'cd' without arguments. or to see how many other files will be printed before yours will come out o lprm jobnumber --. chmod o+r filename will make the file readable for everyone. .converts plain text files into postscript for printing. or if you're at CSLI.change directory. o gunzip filename --. files produced by LaTeX). but you may sometimes want to change these permissions.remove something from the printer queue. Theoretically you also have to specify a printer name. e. and you will see the files in that directory when you do 'ls'.uncompresses files compressed by gzip. File Compression o gzip filename --. Use the -P option to specify the printer name if you want to use a printer other than your default printer. but gzip usually gives the highest compression rate. You always start out in your 'home directory'.compresses files. and chmod o-r filename will make it unreadable for others again. compress). You can use dviselect to print only selected pages.' will get you one level up from your current position.g.tells you where you currently are.print. See 'help printers' for more information about printers and their locations. o dvips filename --. See the LaTeX page for more information about how to save paper when printing drafts.make a new directory cd dirname --. so that they take up much less space. use 'lpr -Pvalkyr-d'. For example. You can find the job number by using lpq. o genscript --. but this isn't necessary as long as you use your default printer in the can make big leaps or avoid walking around by specifying pathnames. You can even print it directly. Consider making an alias like alias ecop 'genscript -2 -r \!* | lpr -h -Pvalkyr' to print two pages on one piece of paper.g.lets you change the read. o gzcat filename --. if you want to print double-sided.. pwd --.• • • chmod options filename --. For example. you may want to use 'lpr -Pcord115-d'. Usually text files compress to about half their original size. You don't have to walk along step by step . o lpq --. • • • mkdir dirname --. See help protection for more details. 'cd . too (e.gz' appended to the original filename. and execute permissions on your files.check out the printer queue. and gives you some options for formatting.e. You basically 'go' to another directory. like folders on a Macintosh. are used to group files together in a hierarchical structure. using gzcat filename | lpr printing o lpr filename --. The default is that only you can look at them and change them. Directories Directories. write. There are other tools for this purpose. Gzip produces files with the ending '.print .

not just to other people on turing. and even doing serious corpus work. e. as a quick check whether you got new mail. but do remember the name. .Finding things • • ff --. which you should do regularly (at least once a year). too. Useful if you're looking for someone who's actually physically in the same building as you. passwd --. See the elm page.lets you send e-mail messages to people around the world (and.looks for the string in the files. figuring out which is the right version of something. and make sure *you* have logged out. e.lets you have a (typed) conversation with another user write username --. This can be useful a lot of purposes. of course. This information is also displayed by 'finger'. last will give you a list of everyone's logins.tells you who's logged on.g.lets you exchange one-line messages with another user elm --.lets you change your password. This can be extremely useful if you've forgotten in which directory you put a file. and find out about the departmental mailing lists (which you can also find in /user/linguistics/helpfile). egrep.tells you when the user last logged on and off and from where. but isn't. grep string filename(s) --.tells you who's logged in.plan files of course you can finger yourself.find files anywhere on the system. e. You should realize that this information is accessible from anywhere in the world. or in some other particular location. but the one we recommend. Sounds useless. Check out the man pages if this sounds good to you.g. when they last read their mail and whether they're logged in.plan file soon. About other people • • • • • • • w --. The file needs to be readable for everyone in order to be visible through 'finger'. finger username --. It's not the only mailer you can use. talk username --. in a file called . About your (electronic) self • • • whoami --. Without any options. read them).returns your username.g. Often people put other practical you lots of information about that user. This can also be useful for finding other things on the system. who --. In fact. and where they're coming from. See the LRB guide and/or look at help password. and what they're doing.plan. if you use ff -p you don't even need the full name. finger & . Try to create a useful . Look at other people's . just the beginning. Do 'chmod a+r .g. You may need to find out who it is who forgot to log out somewhere. finding the right file among many. That can be useful e. This allows you to see whether they're actually sitting there typing away at their keyboards right at the moment. last -1 username --.plan files for ideas. grep comes in several varieties (grep. such as phone numbers and addresses. documentation. and fgrep) and has a lot of very flexible options.plan' if necessary. Especially useful: the 'idle' part.

this list will contain the processes you need to kill.*}. The most important commands within ftp are get for getting files from the remote machine. which sometimes happens. Use rlogin whenever possible.shows the disk usage of the files and directories in filename (without argument the current directory is used). But attempt without that option first. If the process doesn't 'die' properly. use binary mode.lets you download files from a remote host which is set up as an ftpserver. then \tty{=. don't panic. you can (temporarily) put a copy in /user/ftp/pub/ what your disk quota is (i. Get the ID by using ps. and in case you've exceeded your quota (which you'll be given an automatic warning about by the system) how much time you have left to sort them out (by deleting or gzipping some. but be sure not to confuse the two.kills (ends) the processes with the ID you gave. ask Emma. These will show only when you use ps -efl. It will first let you read the news local to turing. Just try again :) If you're using an X-display you may have to kill some X processes before you can start them again. and keeping track of your phonebill if you're making a non-local phonecall for dialling in.probably the easiest and most fun way to go.lists your processes. of course. du filename --.also lets you connect to a remote host.e. If you want to read only the local or remote news. Be careful not to kill your current shell .lists your last logins. quota -v --.• • • • • ps -u yourusername --. ftp just overwrites files with the same filename. then \tty{:man}. respectively. This is a common method for exchanging academic papers and drafts. Or check out the hypertext nn FAQ . rlogin hostname --. when you have been kicked out of a dialin session or have otherwise managed to get yourself disconnected abruptly. If you need to make a paper of yours available in this way. and anything you were running. Can be a useful memory aid for when you were where.lets you connect to a remote host telnet hostname --. last yourusername --.the one with the number closer to the one of the ps command you're currently running. Sounds straightforward. . because they're root processes. because it doesn't give the process a chance to finish possibly important business before dying. This works only for your own processes. especially when your physical location doesn't correspond to the direction of the ftp connection you're making. then \tty{Z}. you can use nnl or nnr. how much space you have to store files). Or look at the man page. use the option -9. kill PID --. Connecting to the outside world • • • • nn --. Normally. then hit the space bar to step through the manual. Those may include the shell (tcsh or whatever you're using). or moving them to your own computer). You may need to kill processes for example if your modem connection was interrupted and you didn't get logged out properly. If you're transferring anything other than ASCII text. To learn more about nn type nn. For more permanent solutions. and then the remote news. and put for putting them there (mget and mput let you specify more than one file at once). Contains lots of information about them. how much you're actually using. including the process ID. du -s gives only a total. for example emacs or elm. which you need if you have to kill a process.allows you to read news. how long you've been working for. But if it happens. ftp hostname --.

you need to source your dotfiles after making changes for them to take effect (or log off and in again) . The one that you're most likely to have to set is the DISPLAY variable. but you can just do setenv TERM vt100 (or whatever). if you typed a wrong value for the TERM variable when logging in. when using an X-display. You can type any URL as an argument to the G command.shows the current date and time.shows the value of an environment variable setenv --.lets you un-set environment variables. Useful to determine which one you want to foreground if you have lots of them. Type H at any time to learn more about lynx. because you have hit return in addition) !pattern --. you don't have to log out and start over.lets you browse the web from an ordinary terminal.repeat the last command that starts with pattern echo $VARIABLE --. and Q to exit. Use e. or if you set the DISPLAY variable automatically but want to avoid opening windows for some reason. When you're doing this from any Stanford host you can leave out the . For example. or 'cal 1995' to get the whole year..looks up the word in an electronic version of Webster's dictionary and returns the definition(s) date --. type env.shows you the manual page for the command For further ways of obtaining help. for example.foreground a job !! --. is safer.background a job after suspending it. More UNIX Commands I have noticed that the overwhelming majority of visitors come to this page via a Lycos search. Useful. Miscellaneous tools • • • webster word --. This page is probably *not* what you're looking for .edu part of the URL when connecting to Stanford URLs. if you've usually set autologout but want to stay logged on for a while without typing for some reason.repeat the previous command (but CTRL-p. You can find out more about these commands by looking up their manpages: man commandname --.shows a calendar of the current month. bg --.g. look at the pages with electronic sources of information and non-electronic sources.lists your currently active jobs (those that you put in the background) • • • • • • • • and their job numbers. To see what all your environment variables are set to. unset VAR --. fg %jobnumber --. not the pictures.see the links at the bottom of this page for more useful information! • jobs --.• lynx --. cal --. source filename --. 'cal 10 1995' to get that for October 95.stanford.lets you set environment variables. Of course you can see only the text.

checks the syntax of html files latex2html --. synonyms.cancel the processes after it has started CTRL-z --.complete filename or command up to the point of uniqueness CTRL-u --. . or hyponyms.go forwards in the history of commands (you can also use the cursor down key for this) CTRL-c --. hypernyms.delete next character CTRL-k --.Lets you execute any number of commands in a sequence.will show you the load average graphically ispell filename --. (you can also use the cursor up key for this) CTRL-n --.go backwards without deleting CTRL-f --. then the one before that. and linguistics terminology are a typos in every paper you write. for example.lets you access the WordNet database and display.cancel whole line CTRL-p --. If you're running it on a LaTeX file use the -T option to tell it to ignore the LaTeX commands. You can • • • create and use your own dictionary to avoid having it tell you that your own the last command typed.g. in order to do something else in between) you can then put the process in the background with bg CTRL-l --.• • load --. etc.translates LaTeX files into HTML wn word option --.will check the spelling in your file.delete previous character CTRL-d --. those of fellow linguists.go to end of line CTRL-b --. weblint --.delete rest of line CTRL-a --.go forward without deleting Other useful things TAB --. depending on the option you select Command editing in the tcsh These things are the same as in emacs: Backspace --.redraws the screen | (piping) --.go to start of line CTRL-e --.suspend a running process (e.

UNIX Editor Commands. `d (CR)' for a short new page.very useful when you have a suspicion some command may be capable of doing what you want. UNIX Process Commands. UNIX Mail Commands. and you'd have to remember to remove all the junkfiles afterwards. UNIX Command Dictionaries The UNIX manual is mostly on line and the UNIX `man' command is used to display parts of the manual. Some examples that show the usefulness of this: ls | more --. e. UNIX Information Commands. and so forth. The vi Editor. For the CMS paging prompt `holding'. You respond to the UNIX paging prompt `:' with a `(CR)' return for a new page. also ps -aux man ls | grep time --. UNIX File Commands. The ex Editor. UNIX makefile Commands. respond with the designated . which is useful with any command that will produce a lot of output. UNIX Pipe and Redirection Commands. using the previous command's output as input.will show you one screenful at a time. UNIX Control-Key Commands. but that would be much more complicated. Typing man [command] (CR) will yield information in an almost readable format during a IBM Telnet session. The problem is that you have both UNIX and CMS paging the output. UNIX C Language Commands. Some policies on turing • • • • • • • • • • • • • • UNIX Log In and Out Commands. UNIX Directory Commands. since they're large and usually can be deleted.will show you all your dvi files .g.The second command will be executed once the first is done.checks whether the man page for ls has something to say about listing files by time . You can achieve the same effect by putting the output in a file and giving the filename as an argument to the second command.useful to solve disk space problems. but you aren't sure. ls -lR | grep dvi --. u (CR)' for a short page up (back). or `q (CR)' to quit. UNIX Terminal Environment Commands.

`(CR)' is used for new `man' pages. The format is [command] [generic operand] : [Definition. For a quick overview of a command try the `-q' quick option: man -q command] (CR) Alternatively. but read some of it and try it out at an actual computer session. The version `man -blou [command] (CR)' should remove underscoring and other backspacing for printing at UIC. UNIX is a trademark of Bell Laboratories. so the CMS user has to press both the `Return-key' for a new UNIX `man' page or the `Clear-key' for a new CMS page depending on the odd UNIX prompt or the CMS ``HOLDING'' prompt. DO NOT FORGET that almost all UNIX commands must be in lower case. If you are using IBM Telnet. man [command] > [file] (CR) is useful for redirecting the output to a file that can later be transfer back to CMS for printing (e. Return to TABLE OF CONTENTS? UNIX Information Commands man [-option] [command] (CR) : Manual or UNIX help command.] along with a carriage return `(CR)' for each command.`Clear-key'. but does not work completely. Do not attempt to learn all of this at once. but with enough commands to be able to do something useful. The UNIX no paging `-r' option does not work in a CMS session. Return to TABLE OF CONTENTS? UNIX Log In and Out Commands: login (CR) : Logon command. by `printdoc'). During a IBM Telnet session the `Clear-key' is needed for new CMS pages .g. logout (CR) : Logoff command. For more information use the `man' command or refer to some of the UNIX texts. This abridged UNIX dictionary is only intended to be a short enough list to get you started without being bewildered by the enormous UNIX manuals. The usual quit sequence `q (CR)' can be used to quit long UNIX `man' listings. then `man [command]' usually produces poor output for the head of the display. respectively.

For example: . who (CR) : Displays currently logged in users. Other `-h' suboptions are `ivdep' for ignore vector dependence. Some standard C options are `-htask3' for automatic parallelization (autotasking in crayese) and `-hvector3' for more powerful vector restructuring. A commonly used form will be cc -o run -h report=isvf [file]. using the standard C compiler `scc2. use `scc3. `-hnovector' for no vector (vector is the default). Otherwise `d'. e. and `-hreport=isvf' writes same messages to `[file]. who am i (CR) : Displays current user id and access.0' and producing an executable named run. `whereis kermit'.c.0' and producing an object file named [file]. In place of `cc'. which [name] (CR) : Tell which version of a program or command will be used in your session in case of multiple copies.v'.g. `hreport=isvf' generates messages about inlining (i). e. whatis [command] (CR) : Describes the command [command].c.c (CR) : Compiles source [file].c (CR) : Compiles source [file]. Some other optimization related options are `-hinline' for inlining while `-hnone' is the default no inlining. scalar optimization (s) and vector optimization (v). using the standard C compiler `scc2. whereis [name] (CR) : Locates source for program or command. `which cc'.0' or `scc' for the latest version of standard C or `pcc' for portable C.that are not the same as the `man' pages. #define fortran : Form of C header statement to permit the call to a fortran subroutine from a C program. `q' or `Ctrl-c' should work for UNIX like access.o.0' and producing an executable file named run without scalar optimization or vector optimization while `hopt' enables scalar and vector optimization. cc -c [file].c. finger [user] (CR) : Displays system biography on user `[user]'. cc -hnoopt -o run [file]. Return to TABLE OF CONTENTS? UNIX C Language Commands cc -o run [file]. and `-h listing' for a pseudoassembler (CAL) listing.g.c (CR) : Compiles source [file]. using the standard C compiler `scc3.c (CR) See `man cc' or `docview' for more information.

#include <stdio. y). the making is done with `make run (CR)'. `vector' for turning it back on. must be preceded by a `Tab-key' tab as a delimiter.f (CR) : Automatically generates a makefile for compiling under the `cft77' compiler and loading up the executable file named `[executable]'.. where some example directives are `ivdep' for ignoring vector dependence.g.14. For example.l &. Caution: the makefile only uses the source name only when that coincides with the name used in the Fortran `program' statement and only one type of `cft77' flag can be used. Invoke with `make -f [make-name] [executable](CR)' and the execute `[executable]'.f. the file `makefile. y.. run<data>out''.unicos_2 mrun>& pgm.o FLAGS = -em mrun : $(OBJECTS) segldr -o run $(OBJECTS) . These flaws can be corrected by editing the resulting makefile `[make-name]'... See `vector directives' for instance in `docview' for more information and examples.h> #include <fortran.. executable named `run'. etc.o : cft77 $(FLAGS) $*. flowtraces. `make -c cft77 -f -em -o run pgm.h> #define fortran main() { fortran void SUB().f {CAUTION: The commands. and clean-up.f (CR)' produces a makefile named `makefile'. x.unicos_2': # Use ``make -f make. like `segldr' or `cft77'.. performance traces. `relcpus'.. `getcpus [p]'.l' with loops marked by optimization type. `parallel . float x = 3. . but the tab will not be visible in the UNIX listing. e. } #pragma _CRI [directive] : Form of C compiler directive placed within the C code. SUB(&x. Also produces steps for profiling. Return to TABLE OF CONTENTS? UNIX makefile Commands make [-options] [step-name] (CR) : Makes the files [files] according to the template in the `makefile'. `noreduction'.'. `inline' for procedure inline optimization. See the examples `makefile *' on the `getdisk hanson' disk in CMS. in the heavily documented makefile.f OBJECTS = pgm. and `end parallel'.. &y).} fmgen -m [make-name] -c cft77 -f [-flag] -o [executable] [source]. `novector' for turning off the default vectorization. SOURCES = pgm.. an information listing named `[name in program statement]. `shortloop'. printf("SUB answer: y = %f for x = %f\n".

. cd $TMP (CR) : changes to your temporary directory. `mv addtwo. `cd $HOME (CR)' returns the shell back to your home directory.. if `pushd' was used before. This format works for `cp' also. `echo $HOME (CR)' displays the home directory..* diradd' moves all files with prefix `addtwo. same as `cd $TMP (CR)'. e. This format works for `mv' also. pushd [name] (CR) : Pushes from the working directory to the directory [name] keeping the sequence of directories in a buffer for `popd'. e. [fileN] [directory] (CR) : moves `[file1]'. For this reason. `. popd (CR) Pops back up to the prior directory. `cp [file] .g.. `pushd' and `popd' are more useful than the regular change directory command `cd'. cp [file1] [directory]/[file2] (CR) : copies [file1] into [file2] in directory [directory]. ls [directory] (CR) : displays the contents of the directory `[directory]'. pwd (CR) : Displays working directory. cd ~[user] (CR) : Changes working directory to that of login id `[user]'. mv [file1] .' to the directory `diradd' which must already exist from a prior 'mkdir diradd' command.' denotes the current directory and `.Return to TABLE OF CONTENTS? UNIX Directory Commands mkdir [name] (CR) : Makes a directory or file group name [name]. . rmdir (CR) : Removes or erases empty directory.g. .. you can change it back with `cd(CR)' using your own login id..' denotes the root or parent directory. `mkdir dirpgm (CR)' make the directory called `dirpgm'. `[fileN]' to directory `[directory]'. Return to TABLE OF CONTENTS? UNIX File Commands ls (CR) : Lists sets or files of current user id or current directory. cd [directory] (CR) : Changes the working directory to the directory [directory]. You must first use `rm *' to empty the file. (CR)' copies a file to the current directory using the original name.

' to catenate and store the N files in `[fileM]'.e. Also `ls ~/ [directory] (CR)' will list the contents of the directory `[directory]' on the same ~[user] (CR) : Lists files or directories under user/account id `[user]'.cshrc'. `[who]' is `u' for the user. ls [string]. Note the different string pattern. write and execute permissions for the file (or files) `[file]' according to the `[mode]' which has form `[[who] [operator] [permission]]'. Examples of other forms are `ls *[string] (CR)' or `ls *[string]* (CR)' or `ls *[string1]*[string2]*'. `y' for yes and `n' for no target file `[file2]' already exists to avoid unintentional. `w' for write and `x' for execute.. `[operator]' is `+' to add and `-' for remove. can take several file arguments. rm [file1] (CR) : Erases file `[file1]'. . ``cat [file1] [file2] | grep `[string]' (CR)'' searches for the pattern `[string]' in the catenated files. `g' for the defined group'. i. [fileN] (CR) : Lists content of N (N . moves one file to another. use `d' for 11 more lines or `u' to go back up 11 more lines.le. with the standard single quote used within the command to enclose the target string when it is more than one word. Use `cat [file] (CR)' with the CMS Clear-key instead. respectively. respectively. Use `cat [file1] . `[permission]' is `r' for read. grep `[str]' [file1] (CR) : Searches for string [str] in file [file1]. use `q (CR)' for quitting. diff [file1] [file2] (CR) : Displays the difference between files `[file1]' and `[file2]'. with each remaining subfield of three denoting the user. more [file] (CR) : Displays file in half pages of 11 lines. `o' for others and `a' = `ugo' for all. the user may be queried about removing protection for his own files.. [fileN] > [fileM] (CR). with the system asking if you really want to do it. {The query can be removed in any session by the command `unalias rm (CR)' or permanently by editing the C-shell resource configuration file `. cp [file1] [file2] (CR) : Copies file `[file1]' into file `[file2]'. 1) argument files catenated. current permissions are displayed with the default long list command `ls [file] (CR)' in the first field or the sample forms `drwxrwxr-x' or `-rwxr--r--' with the first character denoting a directory if `d' is present.} mv [file1] [file2] (CR) : Renames file `[file1'] as file `[file2]'. a `--' denotes no permission. `chmod u+w [file]' adds write permission to only the user... `f' and `b' produce full pages forward and backwards.* (CR) : Lists all current files with prefix [name]. cat [file1] . chmod [mode] [file] (CR) : Changes the read. group and others. for example `chmod go-wx *' removes write and execute permissions in the current directory for all but the user. similarly. while `/[string]?[string] Caution: works poorly with TELNET from CMS..

one of the UNIX operating sub-systems. [command] & (CR) : Executes `[command]' in the background. alias [command nickname] `[command definition]' (CR) : Makes alias for commands to save typing. but only when the definition contains delimiters like blanks.g. `cat [fn1] [fn2] > [fn3] (CR)'.. `ls -l | grep `Jan 31' (CR)' lists only those files last changed on January 31. The quotes around the definition are not required for single words. history (CR) : Lists the history of the most recent commands entered.. `run > & [output] (CR)'.. {`csh' is the UNIX C-shell. E. ![string] (CR) : Repeats execution of the last command beginning with the pattern [string] in the `history' listing.} [command] > [file] (CR) : Redirects standard output of command [command] to file [file]. ![string]:p (CR) : Repeats listing of the last command beginning with the pattern `[string]' in the `history' listing.Return to TABLE OF CONTENTS? UNIX Pipe and Redirection Commands The commands in this subsection embody some of the powerful advantages of UNIX. [cmd1] | [cmd2] (CR) : Pipes output of command `[cmd1]' to input of command `[cmd2]'.g. ![number] (CR) : Repeats execution of the command numbered `[number]' in the `history' listing. [command] > & [file] (CR) : Redirects standard and diagnostic or error output of [command] to file [file]. catenating two files into a third file.g. Caution: the string `Jan 31' must be enclosed in single quotes. E. `run < [data] >> [output] (CR)'.g. . so you can work at something else in your session.cshrc' file and execute by `source . execute `run' and stores results into the file `[output]'.. catenates the new output with the current file `[output]'. E. `run < [data] > [output] & (CR)'. put the `alias' in the group account `.. puts compiled listing and errors into the file pgm. but does not execute it. E. but the quotes are optional for single words without delimiters.l when pgm.cshrc}. [command] >> [file] (CR) : Redirects standard output of `[command]' and appends it to `[file]'. E.f is compiled. If used a lot. and `rc' stands for resource configuration. You can return (CR) to execute or you can modify it by the command that follows immediately below.g.

permits you to forward message `[N]' to `[user]'.} UNIX users should not encounter IBM Telnet problems. `e [N] (CR)' to edit number [N] or look at a long file with `ex' {see Section on `EX' below}.e.^[str1]^[str2] (CR) : Replaces string `[str1]' with `[str2]' in the previous command and executes the modified command.[dept]. enter the `ex' line editor with `~e (CR)' or `vi' visual editor with `~v (CR)' (see Sections on EX and on VI) to make changes on entered lines. and `q (CR)' to quit. carriage return to enter each line. a `~m [N] (CR)' inside the message after entering a subject. `m [user] (CR)' permits you to send mail to another account `[user]'. {A bug in the current version of Telnet does not allow you to send a copy using the `cc:' entry. {Caution: for a IBM TELNET session. However. as with CMS SENDFILE. `\d (CR)' to end the new message {see the send form below.uic. enter a file with a `~r[filename] (CR)'.cc. but this masked interrupt . stops printing and returns to UNIX. i. Ctrl-c : Interrupt or break character. `s [N] mbox (CR)' to append message `[N]' to your mailbox `mbox' file or `s [N] [file](CR)' to append `[N]' to another file. the text is entered immediately in the current blank space.. route a copy to user `[userid]' by `~c[userid] (CR)'. Return to TABLE OF CONTENTS? UNIX Mail Commands mail (CR) : Shows user`s < [filename] (CR) : Sends the UNIX file `[filename]' to user `[userid]' at UICVM. mail [name]@[machine]. from (CR) : Tells who the mail is from.`x' quits `mail' without deleting {use this when you run into problems}. should use \c (CR).edu < [filename] (CR) : Sends the UNIX file `[filename]' to user `[name]' on some UNIX or other machine. to `[userid]'`s CMS. use the subcommand `t [N](CR)' to list message number `[N]' . exit `mail' by entering `\d (CR)'. Return to TABLE OF CONTENTS? UNIX Control-Key Commands Ctrl-h : Erase or backspace over character. mail [userid]@uicvm. mail [user] (CR) : Sends mail to user `[user]'.uic. `v [N] (CR)' to edit number [N] or look at a long file with `vi'. exiting `ex' with a `wq (CR)' or `vi' with a `:wq' (CR)'. `d [N] (CR)' deletes {your own mail!} `[N]'. note the CTRL-key and h-key must be simultaneously pressed. ending with the ``hack'' `\d [user_cc] (CR)' should get a copy to user `[user_cc]'.

WARNING: Several terminal commands are given here.. HOME. setenv TERM vt100 (CR) : Sets `TERM' variable to type `vt100'. Note that one of the biggest problems in working with advanced.termcap' and enable it with the command `setenv TERMCAP $HOME. Caution: `YTERM' is ideal for PC to CMS communication. The recognizable terminal type are in the alphabetized subdirectories of `/usr/lib/terminfo'.will not work during long listings due to interference of the CMS `Clear-key' in IBM Telnet sessions. PATH. but `unknown' type means a poor line edit session). and AFSTMP. also try `stty everything'. tset -m :h19b (CR) : Sets terminal type to Heathkit or Zenith type `h19b'. AFS. terminal types and key assignments. Return to TABLE OF CONTENTS? UNIX Terminal Environment Commands printenv (CR) : Print out environment meta parameters such as defaults. `v' directory contains vt100 listings. but does not have a terminal type that is recognizable by UNIX systems ('vt100' may sometimes work as a substitute. stty erase \[key](CR) : Set or reset the terminal (`tty') erase key to `[key]'. e. eg.. SHELL.login' file. Return to TABLE OF CONTENTS? UNIX Process Commands .g. NCPUS. stty all (CR) : Display usual Control characters. because you might have to try several before you find one that works. Ctrl-w : Word erase character {else for IBM Telnet use `\w (CR)'}. Ctrl-q : Quiet character {else for IBM Telnet use `\q (CR)'}. Ctrl-u : Kill character {else for IBM Telnet use `\u (CR)'}. You can put customized terminal configuration in the file `.termcap' either in your shell or in your '.} Ctrl-s : Stop character {else or IBM Telnet use ` \s (CR)'}. remote computers is COMMUNICATION and that much of this local guide is intended to solve communication problems. TMP. else use `h19b' or your correct terminal emulation if recognizable by the remote host. else use `h19b' etc. TERM. with arguments can be use to set terminal communication variables. setenv TERMCAP vt100 (CR) : Sets `TERMCAP' variable to type `vt100'. which should be the default and can be checked by using `printenv'.

`ed' is another line editor with less availability. The user may want to do major editing on the CMS multi-line editor XEDIT and send the file using the FTP file transfer protocol. and `%' means the whole range of lines `1.. Return to TABLE OF CONTENTS? ex Editor `Ex' is the UNIX line editor (`ed' is another UNIX line editor) and `vi' is the full screen editor that is disabled by IBM TELNET.) vi -r [file] (CR) : Form of `vi' used to recover `[file]' after aborted session. `$' means the last line. More details on `ex' are given in the next section. vi [file] (CR) : Invokes the UNIX full screen editor `vi' to edit file [file]. These `ex' commands can be used within the `vi' editor by typing a colon `:' in front of the `ex' command. rather than `q' to quit. `ex -r [file] (CR)' is for an aborted `ex' session. such as those in the 2249f SEL PC Lab. but the user enters input at the bottom of the screen with IBM TELNET line mode. Similarly. [fileN] (CR)' is the form used for multiple files with the `n' command used to go to the next file. `[L1].' means the current line. this becomes necessary when you lose control of a process or have a session aborted. Some students may have had experience with this editor (or the similar `ed' editor) from EECS courses.l (CR) : Display a simple single line with currently active job status.[L2]' denotes the range from line `[L1]' to line `[L2]'. this visual editor has a large set of subcommands.$'.jobs . which is another reason for learning `ex' with `vi' when you have an account where `vi' can be used. Return to TABLE OF CONTENTS? UNIX Editor Commands ex [file] (CR) : `EX' line editor. . view [file] (CR) : This is the read only form of `vi'. In `ex' `. ps t[N] (CR) : Displays ``pid'' for terminal or tty [N]. This is the preferred editor for LINE EDIT MODE with TELNET. The prompt is `:'. when vi works. Warning: the `vi' command will NOT work properly with the LINE MODE of CMS TELNET and YOU WILL LIKELY GET IN A STUCK SESSION IF YOU TRY IT. ps (CR) : Display current process ids (``pid'') needed for killing. CAUTION: Aborted sessions are not uncommon so it is helpful to develop skills of a super process (program) killer. `:' is the `ex' prompt. Ex can also be used in vi with ':' as a prefix. (Try to get access to a UNIX system or PC Telnet systems. kill -9 [pid] (CR) : Means a ``sure kill'' of ``pid'' [pid]. `ex [file1] ..

`. `% (CR)' lists the whole range of lines. such as End-Of-Line ($ = EOL).[L1]+[N] p (CR) : Prints lines [L1] to [L1]+[N]. use `Ctrl-d'}. nu (CR) : Number current line. then the current file is resaved. new lines are entered following a `(CR)'. i. ?[string] (CR) : Search backward for pattern [string]. and you want to start over at the beginning. the command will be operative until it is changed. [L1].$ (CR)' lists the current line to the last line.[L2] d (CR) : Deletes lines [L1] to [L2]. set list (CR) : Show carriage control characters. by putting this and other commands in your `. End with a lone `.(CR)'. Use. w|n (CR) : When `ex' is used on more than one file.exrc' Ex Resource Configuration file. but do not end. w [file] (CR) : Save (write) or resave into the new file [file]. but do not end. [L1].[L2] p (CR) or [L1]. If no [file] is specified. . q! (CR) : Quit or abort `ex' without saving. in an emergency when your edit session seems hopeless. This is not the usual method for opening a new file.' on a line with an immediate `(CR)'..[L2] l (CR) : Prints or lists (listing control characters) lines [L1] to [L2]. Does not work on an empty file. /[string] (CR) : Search forward for pattern [string].. and `. `|' puts two `ex' commands together. $ (CR) : Prints last line. line numbers are needed for effective use or `ex'. wq (CR) : Save and quit ex. writes the current file and makes `ex' go to the next file. but the usual way does not work correctly with the IBM Telnet and CMS pass through. w! [file] (CR) : Resave (rewrite) into an old file [file]. `Ex' will not write over an existing non-current file with the `w' command without the `!'.(CR)' after the last input line.0a (CR) : This form of the append subcommand puts you in input mode starting with line 1.e. [L1]. \d (CR) : Scrolls lines {In UNIX. [L1] i (CR) : Insert at line [L1]. especially. set number (CR) : Number all lines. and input mode is ended with a solitary or sole `.

See `pu'. and execute commands [commands] on matching lines. works globally. g/[string1]/s/{/}[string2]/gp (CR) : Globally substitute [string2] for each [string1] in all lines and print changes. g/^$/d (CR) : Delete all null lines. [L1]. [L1] o (CR) : The UNIX open command does not work correctly with IBM TELNET because the usual end commands do not work properly.[L2] & (CR) : Repeat prior substitution command. s/A\/B/A\/C/g (CR) : Illustrates the use of `\' to change a string containing the `/' delimiter to change `A/B' to `A/C' globally. [L1] c (CR) : Change line [L1]. Does not work on an empty file. [L1].(CR)' after the last input line. [L1].[L2] m [L3] (CR) : Move lines [L1] to [L2] to after line [L3]. See `pu'. destination [L3] can not be in ([L1] to [L2]-1). [L1]. End with a line `. If `gp' is used in place of `g' then print change(s).[L2] d [buffer] (CR) : Delete and yank lines [L1] to [L2] to named buffer [buffer].[L2] t [L3] (CR) : Take {copy} lines [L1] to [L2] to [L3]. End with a lone `. [L] r [file] (CR) : Read in or append file [file] at line [L]. u (CR) : Undo most recent substitution. end with `.[L1] a (CR) : Append after line [L1].[L2] ya [buffer] (CR) : Yank lines [L1] to [L2] to named buffer [buffer]. [L1]. [L1]. .[L2] g/[string]/[commands] (CR) : Globally search for all occurrences of pattern [string] in lines [L1] to [L2] (or current line only if no lines are given). [L1]. (CR)'. See `ya'.(CR) alone. use `?' in place of `/' if [string*] contains a `/'. [L3] pu [buffer] (CR) : Put lines from named buffer [buffer] after line [L3].[L2] co [L3] (CR) : Copy lines [L1] to [L2] to after line [L3].[L2] s/[string1]/[string2]/g (CR) : Substitute [string2] for all [string1] in lines [L1] to [L2] (or current line only if no lines are given). [L1].

(Esc)'. The subcommand `u' undoes the last function (presumably an error).} (Esc) : End a command.exrc' ex resource configuration profile. Use `:q! (CR)' to end with out saving.Return to TABLE OF CONTENTS? vi Editor The UNIX full screen editor `vi' is a tightly designed editing system in which almost every letter has a function and the function is stronger for upper than lower case. but do not end. :w! [file] (CR) : Save or resave into an existing file [file]. u : Undoes last command. and quit. append `a' or replace 'R'. Customized options are placed in the `. {Remember that `(Esc). but do not end. or `:w (CR)' to only resave. especially in hopeless situations. Use this ex command when your initial vi session is poor. The fact that most keys have a meaning both as single characters and as concatenations of several characters has many benefits. (Esc)' double application certainly ends the function with the ring of a bell. u' key sequence!} {WARNING: `VI' is disabled during an IBM Telnet session. (Esc) : Ensured end of a command with bell. but do not end. (Esc). living the file as it was in the last save. a letter and its actual function are usually closely related. :w (CR) : Save or resave the default file being edited. (Esc). Use `:wq (CR)' to resave and end {`ZZ' also resaves and ends. It is important to remember that the `(Esc)' escape key ends most functions and a `(Esc). but has disadvantages in that mistakes can turn out to be catastrophic. :wq (CR) : Save the default file being edited. . :q! (CR) : Quit vi without saving. provided no changes have been made since the last save. usually used after `(Esc)' or `(Esc). press the Escape-key twice. The character `:' prompts the UNIX line editor `ex' which you can think of as being embedded in `vi'. but will not resave if the file has been saved in another file and no further changes have been made}. Most `vi' subcommands are not displayed when used and do not take a carriage return `(CR)'. However. :q (CR) : Quit vi without saving. if undoing is worse then repeat `u' again to undo the undoing. :w [file] (CR) : Save into a new file [file]. especially used with insert `i'. Some of the above critical `vi' subcommands are repeated below with others. use it. :set all (CR) : Display all vi options.

{Warning: if you just saved the edited file into any other file. ^ : Go to beginning of the nonblank part of the line (BOL).} h or j or k or l : The arrow keys.: Moves cursor [N] lines backwards. such that k = up ^ | h = left <-. . the file will NOT be resaved. $ : Go to end of the line (EOL). (CR) : moves cursor a line forward. `$G' does the same thing. [N]-. 0 : Go to beginning of the line (BOL). G : Go to the last line just before the end of file (EOF) mark. and quit `vi'. % : Find the matching parenthesis. -.--> right = l | v j = down each take a number prefix that moves the cursor that many times. `+' also does.ZZ : Save the edited file. provided not changes have been made since the last save of the edited file to any file. ~ : Got to first nonblank character on a line. [L]G : Go to line [L]. Ctrl-f : Moves cursor a page forward. `1G' moves the cursor to the beginning of the file (BOF). Ctrl-u : Moves cursor a half page up. [N]| : Go to column [N] of the current line. [N] (CR) : Moves cursor [N] lines forwards. `:wq (CR) is much safer to use. Ctrl-d : Moves cursor a half page down.: Moves cursor a line backward. Ctrl-b : Moves cursor a page backward.

use `(CR)' in the string to continue input onto new lines. also use for POWER TYPING. ?[string] (CR) : Find the next occurrence of` [string]' backwards. i[string](Esc) : Insert a string `[string]' before current character at the cursor. n : Repeat last `/[string] (CR)' or `?[string] (CR)'. end with `(Esc)' or `(Esc). s[string](Esc) : Substitutes the string `[string]' for the single character at the cursor. so that when you return to the start you know that you have found all occurrences. (Esc)'. J : Joins next line to current line. or `N' to search backwards. but in reverse. use for POWER TYPING input for an old or new file. Use `n' to repeat. I[string](Esc) : Insert a string at the beginning of the current line (BOL). end with `(Esc)'./[string] (CR) : Find the next occurrence of `[string]' forwards. a `(CR)' in the string during the insert is used to continue input on additional lines. end with `(Esc)' or `(Esc). . `O[string](Esc)' opens a new line above the current line for insertion. the subcommand `i' itself and other subcommands are not displayed. : Repeat last change. end with the escape key `(Esc)' or `(Esc). This is best used along with the repeat search `n' or `N'.a `(CR)' in the string during the insert is used to continue input on additional lines. else is like insert `i'. end with `(Esc)'. r[C](SPACE) : Replace a single character over the cursor by the single character [C]. R[string](Esc) : Replace a string of characters by `[string]' in until `(Esc)' is typed to end. o[string](Esc) : Opens a new line below the current line for insertion of string `[string]'. (Esc)'. use `(CR)' in the string to continue input onto new lines. works like `i' or `a'. (Esc)'. finalize with the Space-bar. else it works like insert `i'. A[string](Esc) : Appends a string `[string]' at the end of a line (EOL). . a[string](Esc) : Appends a string `[string]' following the current character at the cursor. also use for POWER TYPING. think of the file as being wrapped around from end to beginning. The multiple form `[N]s[string](Esc)' substitutes `[string]' for the `[N]' characters starting at the cursor. N : Repeat last `/[string] (CR)' or `?[string] (CR)'.

D : Deletes from the cursor to the end of line (EOL).x : Delete the current character at the cursor. "b[N]Y : Yank [N] lines starting with the current line to the buffer labeled b. along with a search `/ [string](CR)' or repeat search `n'. `[N]dw' deletes `[N]' words. use after a yank or delete to a labeled buffer to move groups of lines from one location to another. use after a yank or delete to a labeled buffer to move groups of lines from one location to another. "b[N]dd : Deletes [N] lines starting with the current line to the buffer labeled `b'. any letter other than `x' can be used to name the buffer. w : Move cursor to the beginning of the next word. `[N]e' moves it to the end of the word. "bP : Put back lines from the buffer labeled `b' before or above the cursor. `[N]yy' yanks `[N]' lines. and a repeat change `. `P' puts the contents of the default buffer before the current line. `[N]b' moves it `[N]' words backward.[L2] m [L3] (CR) : Move lines `[L1]' to `[L2]' to after line `[L3]'. `[N]d(SPACE)' deletes `[N]' characters. dw : Deletes the current word. Helpful to use right after a character yank `y' or a character delete `d' or a line yank `yy' or a line delete `dd'. [N]y(SPACE) : Yanks `[N]' characters starting at the cursor and puts them into the default buffer. "bp : Put back lines from the buffer labeled `b' after or below the cursor. safer than the line yank `yy' because it is very easy to accidentally change the default buffer. `[N]dd' deletes `[N]' lines. Some `ex' editor commands that are useful in `vi' follow the `:' prompt. :[L1]. the double quote {"} is used to avoid an id conflict with subcommand names. p : Puts the current contents of the default buffer after the cursor if characters or after the current line if lines. d(SPACE) : Deletes a single character.'. . See the previous section on `ex' for more commands. `[N]w' moves the cursor `[N]' words forward.[L2] d (CR) : Deletes lines `[L1]' to `[L2]'. :[L1]. :nu (CR) : Number current line. dd : Deletes the current line.

use `?' in place of `/' if `[string*]' contains a `/'. :g/[string1]/s/{/}[string2]/gp (CR) : Globally substitute `[string2]' for each `[string1]' in all lines and print changes.:[L1]. destination `[L3]' can not be in `[L1]' to `[L2]-1'.[L2]s/[string1]/[string2]/g (CR) : Substitute `[string2]' for all `[string1]' in lines `[L1]' to `[L2]' only. works globally.[L2] t [L3] (CR) : Take [copy] lines `[L1]' to `[L2]` to `[L3]'. . :[L]r [file] (CR) : Append file [file] at line `[L]'. :s/[string1]/[string2]/gp (CR) : Substitute `[string2]' for all `[string1]' in current line only and print change(s). :[L1].

Sign up to vote on this title
UsefulNot useful