Some Basic UNIX Commands

by Donald Hyatt The UNIX operating system has for many years formed the backbone of the Internet, especially for large servers and most major university campuses. However, a free version of UNIX called Linux has been making significant gains against Macintosh and the Microsoft Windows 95/98/NT environments, so often associated with personal computers. Developed by a number of volunteers on the Internet such as the Linux group and the GNU project, much of the open-source software is copyrighted, but available for free. This is especially valuable for those in educational environments where budgets are often limited. UNIX commands can often be grouped together to make even more powerful commands with capabilities known as I/O redirection ( < for getting input from a file input and > for outputing to a file ) and piping using | to feed the output of one command as input to the next. Please investigate manuals in the lab for more examples than the few offered here. The following charts offer a summary of some simple UNIX commands. These are certainly not all of the commands available in this robust operating system, but these will help you get started. Ten ESSENTIAL UNIX Commands These are ten commands that you really need to know in order to get started with UNIX. They are probably similar to commands you already know for another operating system.
Command 1. ls Example ls ls -alF cd tempdir cd .. cd ~dhyatt/web-docs mkdir graphics Description Lists files in current directory List in long format Change directory to tempdir Move back one directory Move into dhyatt's web-docs directory Make a directory called graphics

2.

cd

3.

mkdir

html man ls Remove directory (must be empty) Copy file into directory Make backup of file1 Remove or delete file Remove all file Move or rename files Look at file. chmod <opt> <file> Example grep "bad word" * Description Find which files contain a certain word Change file permissions read only Change file permissions to executable Change passwd List all running processes by #ID List process #ID's running by dhyatt chmod 644 *. passwd ps <opt> passwd ps aux ps aux | grep dhyatt . these will be quite valuable in managing your own account.4. grep <str><files> 2.tmp mv old.html new.html more index.html lpr index. 9. 8. 5.bak rm *. man Ten VALUABLE UNIX Commands Once you have mastered the basic UNIX commands. rm 7. Command 1. one page at a time Send file to printer Online manual (help) about command 6.bak rm file1.html chmod 755 file.exe 3. 4. rmdir cp rmdir emptydir cp file1 web-docs cp file1 file1. mv more lpr 10.

gzip <file> gzip bigfile gunzip bigfile.tjhsst. gcc (g++) <source> 7.edu ncftp metalab.edu ssh -l dhyatt jazz. telnet <host> ssh <host> 10.tjhsst. history fortune Lists commands you've done recently Print random humerous message .edu 8.5.edu ftp station1. mail (pine) 9. and should not be considered idle entertainment. who finger Example who finger ytalk dhyatt@threat history fortune Description Lists who is logged on your machine Lists who is on computers in the lab Talk online with dhyatt who is on threat 3.tjhsst. kill <opt> <ID> kill -9 8453 gcc file. Command 1.unc. ytalk <user@place> 4.edu < file1 pine telnet vortex. 5. ftp <host> ncftp <host/directory> Ten FUN UNIX Commands These are ten commands that you might find interesting or amusing. They are actually quite helpful at times.gz mail me@tjhsst. 2.c -o file g++ fil2.cpp -o fil2 Kill process with ID #8453 Compile a program written in C Compile a program written in C++ Compress file Uncompress file Send file1 by email to someone Read mail using pine Open a connection to vortex Open a secure connection to jazz as user dhyatt Upload or Download files to station1 Connect to archives at UNC 6.

xeyes xcalc xeyes & xcalc & mpage -8 file1 | lpr Keep track of cursor (in "background") Calculator ("background" process) Print 8 pages on a single sheet and send to printer (the font will be small!) 10. 3. date date cal 9 2000 Print out current date Print calendar for September 2000 7. netscape xv xfig / xpaint Example netscape & xv & xfig & (xpaint &) gimp & ispell file1 latex file. cal <mo> <yr> 8. 5. xemacs / pico xemacs (or pico) soffice & 8. mpage <opt> <file> Ten HELPFUL UNIX Commands These ten commands are very helpful. 6. soffice Run StarOffice.tex Description Run Netscape browser Run graphics file converter Run drawing program 4. a scientific document tool Different editors 7. a full word processor . especially with graphics and word processing type applications. 9.6. gimp ispell <fname> latex <fname> Run photoshop type program Spell check file1 Run LaTeX. Command 1. 2.

2. ) 10.edu xhost - 5. ping (traceroute) ping threat. mcopy.tjhsst.edu traceroute See if machine is alive Print data path to a machine . xhost xhost + threat.tjhsst.tar subdir tar -xvf subdir. or simplifying your own environment.9.ps 7.tar of a directory Extract files from an archive file View a Postscript file 3. gnuplot mdir a: mcopy file1 a: DOS commands from UNIX (dir A:) Copy file1 to A: gnuplot Plot data graphically Ten USEFUL UNIX Commands: These ten commands are useful for monitoring system access. tar tar -cf subdir. ghostview (gv) 8. mformat.tar gv filename. alias alias lls="ls -alF" 4. m-tools (mdir. fold fold -s file1 | lpr 6. df du Example df du -b subdir Description See how much free disk space Estimate disk usage of directory in Bytes Create new command "lls" for long format of ls Permit window to display from xwindow program from threat Allow no x-window access from other systems Fold or break long lines at 60 characters and send to printer Create an archive called subdir. etc. Command 1. mdel.

top top Print system usage and top resource hogs How to quit a UNIX shell. fork. system().www. logout (exit) logout or exit Some Other Useful Pages       Some Useful Files and UNIX Commands: pipe. etc.com 9. Getting Started with vi The Basics of HTML Making a Web Page Using LaTeX Generating Graphs with GNU Plot . 10.yahoo.