Sunteți pe pagina 1din 5

24/02/2017 BasicUNIXCommands

SomeBasicUNIXCommands
byDonaldHyatt

TheUNIXoperatingsystemhasformanyyearsformedthebackboneoftheInternet,especiallyforlargeservers
andmostmajoruniversitycampuses.However,afreeversionofUNIXcalledLinuxhasbeenmaking
significantgainsagainstMacintoshandtheMicrosoftWindows95/98/NTenvironments,sooftenassociated
withpersonalcomputers.DevelopedbyanumberofvolunteersontheInternetsuchastheLinuxgroupandthe
GNUproject,muchoftheopensourcesoftwareiscopyrighted,butavailableforfree.Thisisespeciallyvaluable
forthoseineducationalenvironmentswherebudgetsareoftenlimited.

UNIXcommandscanoftenbegroupedtogethertomakeevenmorepowerfulcommandswithcapabilities
knownasI/Oredirection(<forgettinginputfromafileinputand>foroutputingtoafile)andpipingusing|
tofeedtheoutputofonecommandasinputtothenext.Pleaseinvestigatemanualsinthelabformoreexamples
thanthefewofferedhere.

ThefollowingchartsofferasummaryofsomesimpleUNIXcommands.Thesearecertainlynotallofthe
commandsavailableinthisrobustoperatingsystem,butthesewillhelpyougetstarted.

TenESSENTIALUNIXCommands

ThesearetencommandsthatyoureallyneedtoknowinordertogetstartedwithUNIX.Theyareprobably
similartocommandsyoualreadyknowforanotheroperatingsystem.

Command Example Description

1.ls ls Listsfilesincurrentdirectory
lsalF Listinlongformat

2.cd cdtempdir Changedirectorytotempdir


cd.. Movebackonedirectory
cd~dhyatt/webdocs Moveintodhyatt'swebdocsdirectory

3.mkdir mkdirgraphics Makeadirectorycalledgraphics

4.rmdir rmdiremptydir Removedirectory(mustbeempty)

5.cp cpfile1webdocs Copyfileintodirectory


cpfile1file1.bak Makebackupoffile1

6.rm rmfile1.bak Removeordeletefile


rm*.tmp Removeallfile

7.mv mvold.htmlnew.html Moveorrenamefiles

8.more moreindex.html Lookatfile,onepageatatime

9.lpr lprindex.html Sendfiletoprinter


https://www.tjhsst.edu/~dhyatt/superap/unixcmd.html 1/5
24/02/2017 BasicUNIXCommands

10.man manls Onlinemanual(help)aboutcommand

TenVALUABLEUNIXCommands

OnceyouhavemasteredthebasicUNIXcommands,thesewillbequitevaluableinmanagingyourown
account.

Command Example Description

1.grep<str> grep"badword"* Findwhichfilescontainacertainword


<files>

2.chmod<opt> chmod644*.html Changefilepermissionsreadonly


<file> chmod755file.exe Changefilepermissionstoexecutable

3.passwd passwd Changepasswd

4.ps<opt> psaux Listallrunningprocessesby#ID


psaux|grepdhyatt Listprocess#ID'srunningbydhyatt

5.kill<opt><ID> kill98453 KillprocesswithID#8453

6.gcc(g++) gccfile.cofile CompileaprogramwritteninC


<source> g++fil2.cppofil2 CompileaprogramwritteninC++

7.gzip<file> gzipbigfile Compressfile


gunzipbigfile.gz Uncompressfile

8.mail mailme@tjhsst.edu< Sendfile1byemailtosomeone


(pine) file1 Readmailusingpine
pine

9.telnet<host> telnetvortex.tjhsst.edu Openaconnectiontovortex


ssh<host> sshldhyatt Openasecureconnectiontojazzasuser
jazz.tjhsst.edu dhyatt

10.ftp<host> ftpstation1.tjhsst.edu UploadorDownloadfilestostation1


ncftp ncftpmetalab.unc.edu ConnecttoarchivesatUNC
<host/directory>

TenFUNUNIXCommands

https://www.tjhsst.edu/~dhyatt/superap/unixcmd.html 2/5
24/02/2017 BasicUNIXCommands

Thesearetencommandsthatyoumightfindinterestingoramusing.Theyareactuallyquitehelpfulattimes,and
shouldnotbeconsideredidleentertainment.

Command Example Description

1.who who Listswhoisloggedonyourmachine

2.finger finger Listswhoisoncomputersinthelab

3.ytalk ytalk Talkonlinewithdhyattwhoisonthreat


<user@place> dhyatt@threat

4.history history Listscommandsyou'vedonerecently

5.fortune fortune Printrandomhumerousmessage

6.date date Printoutcurrentdate

7.cal<mo> cal92000 PrintcalendarforSeptember2000


<yr>

8.xeyes xeyes& Keeptrackofcursor(in"background")

9.xcalc xcalc& Calculator("background"process)

10.mpage<opt> mpage8file1 Print8pagesonasinglesheetandsendtoprinter(the


<file> |lpr fontwillbesmall!)

TenHELPFULUNIXCommands
Thesetencommandsareveryhelpful,especiallywithgraphicsandwordprocessingtypeapplications.

Command Example Description

1.netscape netscape& RunNetscapebrowser

2.xv xv& Rungraphicsfileconverter

3.xfig/xpaint xfig&(xpaint&) Rundrawingprogram

4.gimp gimp& Runphotoshoptypeprogram

5.ispell<fname> ispellfile1 Spellcheckfile1

https://www.tjhsst.edu/~dhyatt/superap/unixcmd.html 3/5
24/02/2017 BasicUNIXCommands

6.latex<fname> latexfile.tex RunLaTeX,ascientificdocumenttool

7.xemacs/pico xemacs(orpico) Differenteditors

8.soffice soffice& RunStarOffice,afullwordprocessor

9.mtools(mdir,mcopy, mdira: DOScommandsfromUNIX(dirA:)


mdel,mformat,etc.) mcopyfile1a: Copyfile1toA:

10.gnuplot gnuplot Plotdatagraphically



TenUSEFULUNIXCommands:

Thesetencommandsareusefulformonitoringsystemaccess,orsimplifyingyourownenvironment.

Command Example Description

1.df df Seehowmuchfreediskspace

2.du dubsubdir EstimatediskusageofdirectoryinBytes

3.alias aliaslls="lsalF" Createnewcommand"lls"forlongformatofls

4.xhost xhost+ Permitwindowtodisplayfromxwindowprogram


threat.tjhsst.edu fromthreat
xhost Allownoxwindowaccessfromothersystems

5.fold foldsfile1|lpr Foldorbreaklonglinesat60charactersandsend


toprinter

6.tar tarcfsubdir.tar Createanarchivecalledsubdir.tarofadirectory


subdir Extractfilesfromanarchivefile
tarxvfsubdir.tar

7.ghostview gvfilename.ps ViewaPostscriptfile


(gv)

8.ping pingthreat.tjhsst.edu Seeifmachineisalive


(traceroute) traceroute Printdatapathtoamachine
www.yahoo.com

9.top top Printsystemusageandtopresourcehogs

10.logout logoutorexit HowtoquitaUNIXshell.


(exit)
https://www.tjhsst.edu/~dhyatt/superap/unixcmd.html 4/5
24/02/2017 BasicUNIXCommands

SomeOtherUsefulPages
SomeUsefulFilesandUNIXCommands:pipe,fork,system(),etc.
GettingStartedwithvi
TheBasicsofHTML
MakingaWebPage
UsingLaTeX
GeneratingGraphswithGNUPlot

https://www.tjhsst.edu/~dhyatt/superap/unixcmd.html 5/5

S-ar putea să vă placă și