LEARNING

ls list files and directories
ls -a list all files and directories
mkdir make a directory
cd directory change to named directory
cd change to home-directory
cd ~ change to home-directory
cd .. change to parent directory
pwd display the path of the current directory
cp file1 file2 copy file1 and call it file2
mv file1 file2 move or rename file1 to file2
rm file remove a file
rmdir directory remove a directory
cat file display a file
more file display a file a page at a time
head file display the first few lines of a file
tail file display the last few lines of a file
grep 'keyword' file search a file for keywords
wc file count number of lines/words/characters in file
command > file redirect standard output to a file
command >> file append standard output to a file
command < file redirect standard input from a file
command1 | command2 pipe the output of command1 to the input of command2
cat file1 file2 > file0 concatenate file1 and file2 to file0
sort sort data
who list users currently logged in
a2ps -Pprinter textfile print text file to named printer
lpr -Pprinter psfile print postscript file to named printer
* match any number of characters
? match one character
man command read the online manual page for a command
whatis command brief description of a command
apropos keyword match commands with keyword in their man pages
ls -lag list access rights for all files
chmod [options] file change access rights for named file
command & run command in background
^C kill the job running in the foreground
^Z suspend the job running in the foreground
bg background the suspended job
jobs list current jobs
fg %1 foreground job number 1
kill %1 kill job number 1
ps list current processes
kill 26152 kill process number 26152

Other useful UNIX commands  

quota

All students are allocated a certain amount of disk space on the file system for their personal files, usually about 100Mb. If you go over your quota, you are given 7 days to remove excess files.
To check your current quota and how much of it you have used, type
% quota -v

df

The df command reports on the space left on the file system. For example, to find out how much space is left on the fileserver, type
% df .

du

The du command outputs the number of kilobyes used by each subdirectory. Useful if you have gone over quota and you want to find out which directory has the most files. In your home-directory, type
% du

compress

This reduces the size of a file, thus freeing valuable disk space. For example, type
% ls -l science.txt
and note the size of the file. Then to compress science.txt, type
% compress science.txt
This will compress the file and place it in a file called science.txt.Z
To see the change in size, type ls -l again.
To uncomress the file, use the uncompress command.
% uncompress science.txt.Z

gzip

This also compresses a file, and is more efficient than compress. For example, to zip science.txt, type
% gzip science.txt
This will zip the file and place it in a file called science.txt.gz
To unzip the file, use the gunzip command.
% gunzip science.txt.gz

file

file classifies the named files according to the type of data they contain, for example ascii (text), pictures, compressed data, etc.. To report on all files in your home directory, type
% file *

history

The C shell keeps an ordered list of all the commands that you have entered. Each command is given a number according to the order it was entered.
% history (show command history list)
If you are using the C shell, you can use the exclamation character (!) to recall commands easily.
% !! (recall last command)
% !-3 (recall third most recent command)
% !5 (recall 5th command in list)
% !grep (recall last command starting with grep)
You can increase the size of the history buffer by typing
% set history=100