Thought Id give my 2 cents.
man
* purpose: on-line manual for Unix (or Linux)
* usage: man <program_name> or man -k <keyword>
* examples:
o man man describes the use of the manual
o man -k print lists commands that refer to printing
pwd
* purpose: print position in the file system (Print Working Directory); see also dirs
* usage: pwd
cd
* purpose: Change Directory
* usage: cd <directory_to_go>
* remarks:
o If no target directory is specified, cd will change to the home directory, ~
o A directory can be specified relative to the current location, or by a full pathname.
A full pathname begings with a forward-slash, /, or a tilde, ~.
A ~ by itself denotes the user's home directory.
See the examples below.
* examples:
o cd papers
changes to the subdirectory papers of the current directory
o cd ~/images
changes to the directory ~/images, which is the directory images in the user's home directory; note that the full path is given!
o cd /home/HOMER
changes to the directory /home/HOMER, given by a full path
o cd ~euclid
changes to the home directory of the user whose login-name is euclid
dirs
* purpose: print position in the file system, use ~ if we are inside the home directory; see also pwd
* Note: actually, dirs prints the whole directory stack; the current directory is the first in the list
* usage: dirs
ls
* purpose: list content of a directory, or information about files (LiSt)
* usage: ls [-laR] [<file_names> <directory_names>]
o if no file or directory is specified, it lists the content of the current directory
o -a shows all files (including those that start with a dot)
o -l shows the long form, describing permissions, size etc.
o -R descends recursively through the directories
* example: ls -al ~ shows the whole content of your home directory
mkdir
* purpose: create a new directory (MaKe DIRectory)
* usage: mkdir <directory_name>
chmod
* purpose: change read/write/execute permissions (CHange MODe)
* usage: chmod [-R] <whoHOWwhat> <target>
o who is any combination of
+ u for user
+ g for group
+ o for other
+ a for all (i.e., user, group and others)
o HOW can be one of
+ = for set
+ + for add
+ - for remove
o what is any combination of
+ r for read
+ w for write
+ x for execute
o target is a list of files and directories
o -R causes chmod to descend recursively through the directories
* examples:
o chmod -R go-rw my_papers protects the directory my_papers, and any file or directory beneath it, from being read/written by group and others
o chmod a+r index.html allows everyone to read the file index.html
fg
* purpose: brings jobs that are suspended or in the background to the foreground (ForeGround)
* Note: an alternative to fg is to issue the command %job_number, or %first_few_letters. E.g.: %2 will bring to the foreground the job having number 2, %em will do the same for emacs (assuming there is a unique match)
* usage: fg [job_specification]
o job_specification can be %job_number or %first_few_letters (as above)
o if job_specification is missing, fg will resume the current job
o otherwise, it will resume the specified job
o to find the job numbers, use the command jobs.
* examples: fg %1, fg %em
bg
* purpose: takes jobs that are suspended to the background (BackGround)
* usage: similar to fg
jobs
* purpose: lists the jobs currently executing (running, suspended etc.) in the shell where the command is issued
* usage: jobs
o the current job is always flagged with a +, and the previous job with a -
ssh
* purpose: connect securely to another machine (Secure SHell)
* usage: ssh [-l login_name] [hostname | user@hostname] [command]
* examples:
o ssh math.uh.edu attempts to connect to math.uh.edu, using as login_name that of the user issuing the command
o ssh -l john math or ssh john@math attemps to connect to math as user john
* NOTE: if, e.g., math is not recognized as hostname, you might have to give its full name, math.uh.edu. This is expanded by, roughly speaking, the DNS (Domain Name Server) to the "real" address, which is a number, something like 132.8.182.9.
scp
* purpose: copy securely from another machine (Secure CoPy)
* WARNING: scp will overwrite files without asking for confirmation!
* usage: scp [[user@]host1:]file1 [...] [[user@]host2:]file2
* example: scp
john@math.berkeley.edu
apers/text text_berkeley
copies the file ~/papers/text from the
john@math.berkeley.edu account to the file text_berkeley on the machine (and account) from where scp was issued
pine
* purpose: lets you read, send and handle emails (Program for Internet News and Email)
* usage: pine, and follow the instructions/choices on the screen
xon
* purpose: start an X program on a remote machine
* usage: xon remote-host [-user user-name] [command]
* remarks: when no command is specified, xon runs xterm.
* example: xon math netscape starts netscape on math
tar
* purpose: gather more files/directories into a single file; the same command (with different parameters) will reconstruct the files/directories.
This is useful, say, to make a copy of a directory (e.g., over the Internet), or to compress it (first tar the directory, then compress the resulting file - using gzip & gunzip or bzip2 & bunzip2, etc.)
* usage:
o to create a tar file: tar cvpf <TARGET_FILE.tar> <INPUT>
o to extract the files: tar xvpf <TARED_STUFF>
The INPUT can be a list of files and/or directories.
* example:
o tar cvpf school.tar ~/2001/school will tar the directory (or file) ~/2001/school into the file school.tar
o tar xvpf school.tar will reconstruct the directory (or file) school in the current directory;
NOTE: the file school.tar is not removed
* remarks: see the explanation of the parameters in the man-page;
there are many more possibilities!
lpq
* purpose: check the laser printer queue (Laser Printer Queue)
* usage:
o lpq
The status of the default printer is checked (if such a printer is defined).
o lpr -P <printer_name>
The status of the specified printer is checked.
* examples: lpq -P rm645
check the status of the printer rm645 (which is the default printer)
lpr
* purpose: print a PostScript or text (ASCII) file to the printer (Laser PRinter)
o WARNING: DO NOT SEND OTHER FILES TO THE PRINTER. The result will be a lot of garbage pages.
o If this however happened, you can try to stop the printing with the command lprm - (this might not help always).
o You can check the status of a printer (e.g., jobs in the queue) with the command lpq.
* usage:
o lpr <file>
The file will be sent to the default printer.
If there is no default printer defined, an error message will be issued, and nothing printed.
o lpr -P <printer_name> <file>
The file is sent to the printer specified.
* examples: lpr -P rm645 exam.ps
(rm645 is the default printer)
lprm
* purpose: remove jobs from the printer (Laser Printer ReMove)
Normally, one can remove only his/her own jobs.
* usage:
o You might have to issue the command from the same machine from where the job was sent to the printer.
o If the action is directed to the default printer, the -P parameter can be omitted.
o If the flag - is specified, all queues will be searched (in some versions the corresponding flag is -a, check the man-page).
o lprm -P <printer_name>
remove the last job that you submitted to the specified printer
o lprm -
remove the last job that you submitted from all printer queues
o lprm -P <printer_name> <number>
remove job number <number> from the queue (the job numbers can be seen with lpq)
o lprm -P <printer_name> all
remove all your jobs from the queue
* examples:
o lprm - all
remove all your jobs in all queues
o lprm -P rm645 1 4
remove jobs 1 and 4 from the printer rm645