Some Basic UNIX Commands
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. |
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 | Example | Description |
---|---|---|
1. ls | ls ls -alF | Lists files in current directoryList in long format |
2. cd | cd tempdir cd .. cd ~dhyatt/web-docs | Change directory to tempdir Move back one directory 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 cp file1 file1.bak | Copy file into directoryMake backup of file1 |
6. rm | rm file1.bak rm *.tmp | Remove or delete fileRemove 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 |
Ten 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 | grep “bad word” * | Find which files contain a certain word | |
2. chmod | chmod 644 *.html chmod 755 file.exe | Change file permissions read onlyChange file permissions to executable | |
3. passwd | passwd | Change passwd | |
4. ps | ps aux ps aux ** | ** grep dhyatt | List all running processes by #IDList process #ID’s running by dhyatt |
5. kill | kill -9 8453 | Kill process with ID #8453 | |
6. gcc (g++) | gcc file.c -o file g++ fil2.cpp -o fil2 | Compile a program written in CCompile a program written in C++ | |
7. gzip | gzip bigfile gunzip bigfile.gz | Compress file Uncompress file | |
8. mail (pine) | mail me@tjhsst.edu file1 pine | Send file1 by email to someone Read mail using pine | |
9. telnet ssh | telnet vortex.tjhsst.edu ssh -l dhyatt jazz.tjhsst.edu | Open a connection to vortexOpen a secure connection to jazz as user dhyatt | |
10. ftp ncftp | ftp station1.tjhsst.edu ncftp metalab.unc.edu | Upload or Download files to station1 Connect to archives at UNC |
### Ten FUN UNIX Commands
These are ten 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. who | who | Lists who is logged on your machine | |
2. finger | finger | Lists who is on computers in the lab | |
3. ytalk | ytalk dhyatt@threat | Talk online with dhyatt who is on threat | |
4. history | history | Lists commands you’ve done recently | |
5. fortune | fortune | Print random humerous message | |
6. date | date | Print out current date | |
7. cal | cal 9 2000 | Print calendar for September 2000 | |
8. xeyes | xeyes & | Keep track of cursor (in “background”) | |
9. xcalc | xcalc & | Calculator (“background” process) | |
10. mpage | mpage -8 file1 ** | ** lpr | Print 8 pages on a single sheet and send to printer (the font will be small!) |
### Ten HELPFUL UNIX Commands
These ten commands are very helpful, especially with graphics and word processing type applications.
Command | Example | Description |
---|---|---|
1. netscape | netscape & | Run Netscape browser |
2. xv | xv & | Run graphics file converter |
3. xfig / xpaint | xfig & (xpaint &) | Run drawing program |
4. gimp | gimp & | Run photoshop type program |
5. ispell | ispell file1 | Spell check file1 |
6. latex | latex file.tex | Run LaTeX, a scientific document tool |
7. xemacs / pico | xemacs (or pico) | Different editors |
8. soffice | soffice & | 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. gnuplot | gnuplot | Plot data graphically |
Ten USEFUL UNIX Commands:
These ten commands are useful for monitoring system access, or simplifying your own environment.
Command | Example | Description | |
---|---|---|---|
1. df | df | See how much free disk space | |
2. du | du -b subdir | Estimate disk usage of directory in Bytes | |
3. alias | alias lls=”ls -alF” | Create new command “lls” for long format of ls | |
4. xhost | xhost + threat.tjhsst.eduxhost - | Permit window to display from x-window program from threatAllow no x-window access from other systems | |
5. fold | fold -s file1 ** | ** lpr | Fold or break long lines at 60 characters and send to printer |
6. tar | tar -cf subdir.tar subdirtar -xvf subdir.tar | Create an archive called subdir.tar of a directoryExtract files from an archive file | |
7. ghostview (gv) | gv filename.ps | View a Postscript file | |
8. ping (traceroute) | ping threat.tjhsst.edu traceroute www.yahoo.com | See if machine is alivePrint data path to a machine | |
9. top | top | Print system usage and top resource hogs | |
10. logout (exit) | logout or exit | How to quit a UNIX shell. |