UNIX
SUMMARY OF SOME OF THE MORE USEFUL UNIX COMMANDS
(courtesy of Dr. Patrick Hartigan)
Type 'man cat' to get more information about 'cat', for example. This list includes only a
small fraction of the available Unix commands. Start by learning the ones in boldface.
alias - create shortcut names for commands, e.g. alias iraf 'cd /home/iraf; pwd'
will move you into the /home/iraf directory and then tell you it is there.
These are usually defined in the .cshrc or .tcshrc file. Type 'alias' to
see what shortcuts are defined for you.
apropos - locate commands by keyword lookup e.g. 'apropos print' describes printing commands
awk - pattern scanning and processing language, very powerful
cat - print the contents of a file to the screen. See 'file' command.
cd - change directory (cd .. moves up a directory)
chgrp - change the group ownership of a file. 'ls -lg filename' to see the owner and group.
chmod - change the permissions mode of a file. Use 'ls -l' to see the permissions. The first letter is a d for a
directory and a - for a file. Then there are 3 groups of rwx, one for the owner, group, and everyone else,
where r is read permission, w is write (delete) permission, and x is execute permission.
chown - change owner e.g. 'chown -R user:group *' changes ownership of all files and all directories underneath
the current directory
clear - clear the screen
click - enable or disable the keyboard's keystroke click
colrm - remove characters from specified columns within each line
compress, uncompress, gzip, gunzip - compress or expand files
cp - copy files. Use scp to copy across machines.
date - display date and time
df - report amount of free disk space
diff - display line-by-line differences between pairs of text files
dos2unix - convert text file from DOS format to ISO format
fdformat - format diskettes for use with SunOS
fg - bring a background task to the foreground. The inverse of '&'
find - find files by name. locate is somewhat easier to use. typical format is
find . -name 'data*.dat' -print
This will look in all the directories under your current directory (.) for files
named data*.dat where * is any string. Substitute '?' for '*' to look for only
single character strings, '??' for two characters, etc.
file - determine the type of a file (if it says 'data' don't print it to the screen)
ftp - file transfer program. Use scp instead
f77 - Fortran compiler on Suns
grep - search a file for a string in a file, e.g. 'grep hello text.file'
head - display first few lines of specified files (see also tail)
history -n - print list of n previous commands
kill - terminate a process, locate the process number first using 'ps -elf', then 'kill -9 process_number'
lpq - display the queue of printer jobs. Specify printer ps600 by 'lpq -Pps600'
lpr - send a job to the printer. e.g. 'lpr -Pps600 file' Make sure the file is not data (see file command)
lprm - remove jobs from the printer queue e.g. 'lprm -Pps600 job_number'
ls - list the contents of a directory. -A lists all files, including those beginning with a '.'
the flag -F adds a / to directories so you can see where they are, -l is a long listing
that shows permissions, and -R lists the contents of subdirectories as well.
man - display manual pages for a command
mkdir - make a directory
mv - move or rename a file e.g. if dir is a directory, 'mv file dir' moves a file into the directory.
To move an entire directory to a new one located up one directory 'mv old/* ../new'
To move an entire directory and all subdirectories 'cd olddir; tar cvf - . | (cd newdir; tar xvf -)'
passwd - change your password
ps - display the status of current processes, usually use 'ps -elf'
pwd - display the pathname of the current directory
rm, rmdir - remove files or directories. Type 'rm -rf *.*' to remove absolutely everything in the current
directory and all its subdirectories.
scp - copy a file or files from one machine to another. e.g. 'scp /home/harry/file joe@guitar.fiu.edu:/home/joe'
source - execute a setup file, e.g. 'source ~/.tcshrc' to update changes in your .tcshrc file without logging back in.
sed - stream editor
sort - sort lines in a file
spell - report spelling errors in a file
ssh - secure shell, used for remote logins e.g. 'ssh -l joe guitar.fiu.edu' logs in to guitar as user joe.
tail - display the last part of a file
tar - create and read archives of files. The standard way to back up files and data.
unix2dos - convert text file from ISO format to DOS format
vi, emacs, pico - text editors (pico the simplest, vi and emacs much more powerful)
!! - perform the previous command
!n - perform command number n in the history list. With tcsh you can use the arrow keys to access and edit
previous commands. Also hit the TAB key if you don't want to type out a long file name (file completion)
| - the 'pipe' command. Redirects output to a new command (e.g. 'cat file | lpr' prints the file)
> - redirect output. e.g. 'cat file > file1' redirects the output that would go to the screen
into a new file named file1. Use >! to overwrite an existing file, and >> to append to an existing file