Basic UNIX Commands

Basic UNIX Commands

Linux Reseller Hosting




Basic UNIX commands


These 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                      Example                                      Description
1.     lsls ls -alFLists files in current directory List in long format
2.     cdcd tempdir cd .. cd ~dhyatt/web-docsChange directory to tempdir Move back one directory Move into dhyatt’s web-docs directory
3.   mkdirmkdir graphicsMake a directory called graphics
4.    rmdirrmdir emptydirRemove directory (must be empty)
5.     cpcp file1 web-docs cp file1 file1.bakCopy file into directory Make backup of file1
6.     rmrm file1.bak rm *.tmpRemove or delete file Remove all file
7.     mvmv old.html new.htmlMove or rename files
8.     moremore index.htmlLook at file, one page at a time
9.     lprlpr index.htmlSend file to printer
10.   manman lsOnline manual (help) about command


  • Valuable UNIX Commands

Once you have mastered the basic UNIX commands, these will be quite valuable in managing your own account.


             Command              Example                             Description
1.     grep <str>  <files>grep “bad word” *Find which files contain a certain word
2.     chmod <opt<file>chmod 644 *.html chmod 755 file.exeChange file permissions read only Change file permissions to executable
3.     passwdpasswdChange passwd
4.     ps <opt>ps aux ps aux   |   grep dhyattList all running processes by #ID List process #ID’s running by dhyatt
5.     kill <opt> <ID>kill -9 8453Kill process with ID #8453
6.     gcc (g++)<source>gcc file.c -o file g++ fil2.cpp -o fil2Compile a program written in C Compile a program written in C++
7.     gzip <file>gzip bigfile gunzip bigfile.gzCompress file Uncompress file
8.     mail
mail< file1 pineSend file1 by email to someone Read mail using pine
9.     telnet <host>
ssh <host>
telnet ssh -l dhyatt jazz.hostripples.comOpen a connection to vortex Open a secure connection to jazz as user dhyatt
10.   ftp <host>
ncftp     <host/directory>
ftp ncftp metalab.hostripples.comUpload or Download files to station1 Connect to archives at UNC


  • Fun UNIX Commands

These commands that you might find interesting or amusing. They are actually quite helpful at times, and should not be considered idle entertainment.


      Command      Example                                                   Description
1.     whowhoLists who is logged on your machine
2.     fingerfingerLists who is on computers in the lab
3.     ytalk <user@place>ytalk hostripples.comTalk online with dhyatt who is on threat
4.     historyhistoryLists commands you’ve done recently
5.     fortunefortuneprint random humerous message
6.     datedatePrint out current date
7.     cal <mo> <yr>cal 9 2000Print calendar for September 2000
8.     xeyesxeyes &Keep track of cursor (in “background”)
9.     xcalcxcalc &Calculator (“background” process)
10.   mpage <opt> <file>mpage -8 file1   |  lprPrint 8 pages on a single sheet and send to printer (the font will be small!)


  • Helpful UNIX Commands

These commands are very helpful, especially with graphics and word processing type applications.


                        Command             Example                                   Description
1.     netscapenetscape &Run Netscape browser
2.     xvxv &Run graphics file converter
3.     xfig / xpaintxfig & (xpaint &)Run drawing program
4.     gimpgimp &Run photoshop type program
5.     ispell <fname>ispell file1Spell check file1
6.     latex <fname>latex file.texRun LaTeX, a scientific document tool
7.     xemacs / picoxemacs (or pico)Different editors
8.     sofficesoffice &Run StarOffice, a full word processor
9.     m-tools (mdir, mcopy,
mdel, mformat, etc. )
mdir a:mcopy file1   a:DOS commands from UNIX (dir A:)Copy file1 to A:
10.   gnuplotgnuplotPlot data graphically


  • Useful UNIX Commands:

These commands are useful for monitoring system access, or simplifying your own environment.


          Command                 Example                                Description
1.     dfdfSee how much free disk space
2.     dudu -b subdirEstimate disk usage of directory in Bytes
3.     aliasalias lls=”ls -alF”Create new command “lls” for long format of ls
4.     xhostxhost + threat.hostripples.comxhost –Permit window to display from x-window program from threatAllow no x-window access from other systems
5.     foldfold -s file1   |   lprFold or break long lines at 60 characters and send to printer
6.     tartar -cf subdir.tar subdirtar -xvf subdir.tarCreate an archive called subdir.tar of a directoryExtract files from an archive file
7.     ghostview (gv)gv filename.psView a Postscript file
8.     ping
ping traceroute www.hostripples.comSee if machine is alivePrint data path to a machine
9.     toptopPrint system usage and top resource hogs
10.   logout (exit)logout or exitHow to quit a UNIX shell.


Windows Shared Hosting