Basic Unix commands:
Command Example Description
1. ls ls Lists files in current directory
ls -alF List in long format
2. cd cd tempdir Change directory to tempdir
cd .. Move back one directory
cd ~dhyatt/web-docs Move into dhyatt's web-docs
directory
3. mkdir mkdir graphics Make a directory called graphics
4. rmdir rmdir emptydir Remove directory (must be empty)
5. cp cp file1 web-docs Copy file into directory
cp file1 file1.bak Make backup of file1
6. rm rm file1.bak Remove or delete file
rm *.tmp Remove all file
7. mv mv old.html new.html Move or rename files
8. more more index.html Look at file, one page at a time
9. lpr lpr index.html Send file to printer
10. man man ls Online manual (help) about
command
11. grep <str><files> grep "bad word" * Find which files contain a certain
word
12. chmod <opt> <file> chmod 644 *.html Change file permissions read only
chmod 755 file.exe Change file permissions to
executable
13. passwd passwd Change passwd
14. ps <opt> ps aux List all running processes by #ID
ps aux | grep dhyatt List process #ID's running by
dhyatt
15. kill <opt> <ID> kill -9 8453 Kill process with ID #8453
16. gcc (g++) <source> gcc file.c -o file Compile a program written in C
g++ fil2.cpp -o fil2 Compile a program written in C++
17. gzip <file> gzip bigfile Compress file
gunzip bigfile.gz Uncompress file
18. mail mail [email protected] < file1 Send file1 by email to someone
(pine) pine Read mail using pine
19. telnet <host> telnet vortex.tjhsst.edu Open a connection to vortex
ssh <host> ssh -l dhyatt jazz.tjhsst.edu Open a secure connection to jazz as
user dhyatt
20. ftp <host> ftp station1.tjhsst.edu Upload or Download files to
ncftp <host/directory> ncftp metalab.unc.edu station1
Connect to archives at UNC
21. who who Lists who is logged on your
machine
22. finger finger Lists who is on computers in the lab
23. ytalk <user@place> ytalk dhyatt@threat Talk online with dhyatt who is on
threat
24. history history Lists commands you've done
recently
25. fortune fortune Print random humerous message
26. date date Print out current date
27. cal <mo> <yr> cal 9 2000 Print calendar for September 2000
28. xeyes xeyes & Keep track of cursor (in
"background")
29. xcalc xcalc & Calculator ("background" process)
30. mpage <opt> <file> mpage -8 file1 | lpr Print 8 pages on a single sheet and
send to printer (the font will be
small!)
31. netscape netscape & Run Netscape browser
32. xv xv & Run graphics file converter
33. xfig / xpaint xfig & (xpaint &) Run drawing program
34. gimp gimp & Run photoshop type program
35. ispell <fname> ispell file1 Spell check file1
36. latex <fname> latex file.tex Run LaTeX, a scientific document
tool
37. xemacs / pico xemacs (or pico) Different editors
38. soffice soffice & Run StarOffice, a full word
processor
39. m-tools (mdir, mcopy, mdir a: DOS commands from UNIX (dir
mdel, mformat, etc. ) mcopy file1 a: A:)
Copy file1 to A:
40. gnuplot gnuplot Plot data graphically
41. df df See how much free disk space
42. du du -b subdir Estimate disk usage of directory in
Bytes
43. alias alias lls="ls -alF" Create new command "lls" for long
format of ls
44. xhost xhost + threat.tjhsst.edu Permit window to display from x-
xhost - window program from threat
Allow no x-window access from
other systems
45. fold fold -s file1 | lpr Fold or break long lines at 60
characters and send to printer
46. tar tar -cf subdir.tar subdir Create an archive called subdir.tar
tar -xvf subdir.tar of a directory
Extract files from an archive file
47. ghostview (gv) gv filename.ps View a Postscript file
48. ping ping threat.tjhsst.edu See if machine is alive
(traceroute) traceroute www.yahoo.com Print data path to a machine
49. top top Print system usage and top resource
hogs
50. logout (exit) logout or exit How to quit a UNIX shell.