This table summarizes some common unix commands and may be printed for quick reference.
Other commands may be available for the same or similar tasks.
Task |
Command |
Example |
Working With Files |
List files |
ls |
ls -alF |
Copy | cp fromfile tofile |
cp prog1 prog2 |
Delete |
rm filename |
rm data.csv |
Move files |
mv fromname toname |
mv /scratch/big.data bigdata |
Rename files |
mv oldname newname |
mv old.data new.data |
Display the contents of a file |
more filename |
press the ENTER key to advance a line at a time;
press the SPACE bar to advance a screen at a time;
press CONTROL-C to end |
Find a file |
find "directory" -name "filename" -print |
If you know the name of a file but not where it is, cd to your home directory and use 'find . -name "filename.txt" -print'
|
Working with Directories |
Show working directory |
pwd |
pwd |
Change working directory |
cd dirname |
cd jp |
Change to home directory | cd | cd |
Change to parent directory | cd .. | cd .. |
Create directory | mkdir dirname | mkdir
thesis |
Remove directory |
rmdir dirname |
rmdir loveltrs |
Printing |
Print a file |
lpr -P printername filename |
lpr -P nslaser extract.sas |
Printer status |
lpq -P printername |
lpq -P nslaser |
Cancel print job |
lprm -P printername
jobnum |
lprm -P nslaser 123 |
List available printers |
printers -L |
printers -L | more |
Other Commands |
Check how much disk space you can use |
quota -v |
quota -v |
Edit a file |
pico filename |
pico thesis1.do |
Edit a file |
vi filename |
vi thesis2.do |
Modify access permissions |
chmod attrs filename |
chmod o+r pubinfo |
Display environment variables |
env |
env |
Display a calendar |
cal month year |
cal |
Display current date and time |
date |
date |
Help on a command | man commandname |
man cp
or
lookup man pages
|
Help on a keyword |
man -k keyword |
man -k mail |
See who is logged on |
who |
who |
Look up someone's email address |
ph name |
ph Jane Doe |