Table of Contents Previous Chapter

APPENDIX A UNIX Command Summary

Beginning and Ending Work Session

-------------------------------------------------------
login   Logs you in to the computer you want to use.     
logout  Logs you off the computer you have been using.   
-------------------------------------------------------
Browsing

--------------------------------------------------------------------------------------------
head test      Displays first 10 lines of the file named test.                                
head -25 test  Displays first 25 lines of the file named test.                                
more longfile  Displays file longfile a screenful at a time; press the space bar to continue  
tail test      Displays last 10 lines of the file named test.                                 
tail -5 test   Displays last 5 lines of the file named test.                                  
--------------------------------------------------------------------------------------------
Command History

------------------------------------------------------------------------------------------------
history  Reviews most recent commands.                                                            
script   Starts recording of any subsequent interaction; type exit to stop recording.  The file   
         typescript will hold text of recorded session.                                           
------------------------------------------------------------------------------------------------
Communication

------------------------------------------------------------------------------------------------------------------------------------------------------------------
 biff n         Tells the computer not to notify you as soon as you receive any new mail.                                                                           
                Tells the computer to notify you as soon as you receive any new mail.                                                                               
                Enters mail program to read mail.                                                                                                                   
 biff y                                                                                                                                                             
 mail                                                                                                                                                               
                h                                                                                        shows headers of your mail messages.                       
                ?                                                                                        shows other options.                                       
                number (the message number)                                                              displays mail message with that number.                    
                d number (the message number)                                                            deletes mail message with that number.                     
                s number filename                                                                        saves the  message with the number you specify in the      
                                                                                                         file filename.                                             
                q                                                                                        quits the mail program, appending any messages you         
                                                                                                         have read to the mbox file (your personal Mailbox File).   
                x                                                                                        quits the mail program, leaving any messages in the        
                                                                                                         computer Mailbox File (where all mail is stored until it   
                                                                                                         is read).                                                  
 mail jane      .Sends mail to the user jane on the same computer.  ype message body and end with                                                                   
                CTRL-d.                                                                                                                                             
 mesg n         Prevents others from using the write or talk  command to communicate with you                                                                       
mesg y           Allows others to use the write or talk command to communicate with you.                                                                            
talk smith      Initiates interactive text discussion with logged-in  user jsmith.  Use CTRL-c to quit.                                                             
 telnet sscvx1  Allows you to connect to the computer SSCVX1.                                                                                                       
write jsmith    Sends short message to logged-in user jsmith. Type messages and end with CTRL-d                                                                     
------------------------------------------------------------------------------------------------------------------------------------------------------------------

Comparing and Searching Files


--------------------------------------------------------------------------------------------------------------
cmp file1 file2          Shows the location in file1 where the first difference between the two files occurs.   
diff file1 file2         Displays differences between files file1 and file2.                                    
grep computer intro.doc    Displays all lines in file intro.doc that contain the string computer.               
--------------------------------------------------------------------------------------------------------------
Directory Commands

----------------------------------------------------------------
cd ..             Changes to directory one level above.           
   cd docs/trg    Changes to subdirectory docs/trg.               
   cd /usr/bin    Changes to /usr/bin directory.                  
   mkdir testdir  Creates a new subdirectory called testdir.      
   pwd            Prints name of the working directory.           
   rmdir testdir  Removes subdirectory testdir (must be empty).   
----------------------------------------------------------------
File Commands


-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 cat part1.doc part2.doc  Strings together the files part1.doc and part2.doc, writing its output on stdout.                                                                      
 cp srcfile destfile      Copies the file srcfile to destfile.                                                                                                                   
 ftp slacvx               Allows transfer of files to or from remote computer slacvx.                                                                                            
                          get ftp command                                                                          Transfers a file from the remote computer to your computer.   
                          send ftp command                                                                          Transfers a file from your computer to the remote computer.  
 ls                       Lists files in directory showing which ones are subdirectories, executables, etc. This                                                                 
                          is the SLAC alias for  ls -F                                                                                                                           
ls -a                     Lists files in directory including dot files.                                                                                                          
 ls -l                    Lists files in directory in long form (i.e., with additional information).                                                                             
mv oldfile newfile        Moves or renames file oldfile to newfile.                                                                                                              
rm badfile.tmp            Permanently removes file badfile.tmp.                                                                                                                  
 rm -i  *.c               Removes all files with suffix .c, but asks for confirmation on each file.                                                                              
 sort filename            Reorders the lines contained in the file filename alphanumerically.                                                                                    
 spell filename           Spellchecks the contents of the file filename.                                                                                                         
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Help

-------------------------------------------------------------------------------------
aid unix         Pointer to information about UNIX.                                    
apropos files    Same as man -k.                                                       
man diff         Displays manual page for the diff command.                            
man -k files     Displays commands related to keyword files.                           
man man          Displays information about the online manual.                         
man csh          Displays documentation on commands that are built into the C shell.   
man command      Displays documentation on the specified command.                      
-------------------------------------------------------------------------------------
Miscellaneous


-----------------------------------
date    Displays the date and time.  
-----------------------------------
Other Users

--------------------------------------------------------------------------------------
finger jsmith        Displays user information on jsmith.                               
finger sysop@slacvx  Displays user information on sysop on remote computer slacvx.      
w                    Shows who and what all logged-in users are doing.                  
who                  Tells you who is logged in to the computer.                        
whoami               Displays information on the user logged on to this terminal only.  
--------------------------------------------------------------------------------------
Password


----------------------------------------
passwd    Changes your current password.  
----------------------------------------
Print Commands


-----------------------------------------------------------------------------------------
lpq                      Shows default printer queue.                                      
 lpq -Pcadsun2          Shows the cadsun2 printer queue.                                   
lpr filename            Prints file filename to the default printer.                       
lpr -Pcadsun2 filename  Prints file filename to the printer cadsun2.                       
lprm 34                 Removes current user's print job 34 from the default print queue.  
 ls | lpr -Pcadsun2     Prints the output of the ls command on cadsun2.                    
pr unix.doc | lpr       Produces headers printed on each page of the file unix.doc.        
-----------------------------------------------------------------------------------------
Security


-------------------------------------------------------------------------------------------------
chmod a+x test      Make file text be executable by all users.                                     
chmod g-r,o-r test  Denies the users in the group and others read access to the file named test.   
groups              Displays the group(s) to which you belong.                                     
-------------------------------------------------------------------------------------------------
Shell Related

----------------------------------------------------------------------------------------------------
alias                     Shows all current aliases.                                                  
alias dir ls -l           Assigns the alias dir to the command ls -l.                                 
unalias dir               Removes the alias for dir.                                                  
echo $workdir             Shows the value assigned to shell variable workdir.                         
exit                       Leaves any shell.                                                          
history                    Shows n most recent commands as specified by value n of history shell      
                          variable.                                                                   
set                       With no argument, lists shell variables and their values.                   
set history=20            Sets the shell variable history to 20.                                      
set noclobber              When added to .cshrc file, prevents accidentally overwriting an existing   
                          file with the > character.                                               
set path=(path)           Sets your search path to the directories listed within parentheses.  Do     
                          not separate directories with commas.                                       
set prompt="prompt''      Sets the prompt to be what you specify within the quotation marks.          
set term=vt100             Sets your terminal type to vt100.  Use appropriate terminal type.          
source .cshrc             Runs the commands in the .cshrc file.                                       
printenv                  Prints environment variables and their values.                              
setenv PRINTER cadsun2    Sets the environment variable PRINTER to cadsun2. Notice the capital        
                          ization and spaces.                                                         
unsetenv PRINTER          Undefines the environment variable PRINTER; lpr will then use the sys       
                          tem default printer.                                                        
unalias dir               Remove the alias for dir.                                                   
----------------------------------------------------------------------------------------------------
System Activity

-----------------------------------------------------------------------
uptime      Displays information concerning the status of the computer.  
-----------------------------------------------------------------------
Text Editing

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
emacs unix.doc  Starts the emacs text editor and opens the file unix.doc so you can edit it.                                                                                            
                CTRL-x CTRL-c                                                                             Exits the editor; returns you to the prompt.                                  
                CTRL-x CTRL-s                                                                             Saves your work.  Writes the contents of the buffer (or work space) over      
                                                                                                          the original file.                                                            
                CTRL-x CTRL-                                                                              Editor prompts you for the name of the file where it should save the buffer.  
                w                                                                                                                                                                       
                CTRL-z                                                                                    Suspends the editor.  The editor remembers your files and buffers so you      
                                                                                                          can begin where you stopped when  you issue the command fg.                   
fg              Resumes the editor stopped with CTRL-z.  The editor remembers your files and buffers so                                                                                 
                you can resumewhere you suspended.                                                                                                                                      
vi unix.doc     Starts the Vi text editor and opens the file unix.doc so you can edit it.                                                                                               
                 :q                                                                                       Quits the editor if the file hasn't changed.                                  
                 :w                                                                                       Saves your work.  Writes the contents of the buffer (or work space) over      
                                                                                                          the original file.                                                            
                CTRL-z                                                                                    Suspends the editor.  The editor remembers your files and buffers so you      
                                                                                                          can begin where you stopped when  you issue the command fg.                   
 fg             Resumes the editor stopped with CTRL-z.  The editor remembers your files and buffers so                                                                                 
                you can resumewhere you suspended.                                                                                                                                      
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
Table of Contents Next Chapter