Professional Documents
Culture Documents
UNIX/LINUX Command Reference Sheet: File Commands Process Management
UNIX/LINUX Command Reference Sheet: File Commands Process Management
FileCommands
cat concatenatesanddisplaysfiles
cat > file placesstandardinputintofile
cd changecurrentdirectory
cmp comparestwofiles
cp copiesafileoradirectory
cut removescolumnsorfieldsfromthespecified
file(s)
diff displayslinebylinedifferencesbetweentwo
textfiles
head displaysthefirstlinesofthespecifiedfile(s)
join joinstwofiles
jot printsequentialorrandomdata
ln makehardorsymboliclinkstofiles
ls -al formattedlistingwithhiddenfiles
ls directorylisting
mkdir dir createadirectory dir
more/less outputthecontentsofthespecified
file(s)inpages
mv renameormoveafile
nl putlinenumbersonafile
od sequentiallycopieseachfiletostandardoutput,
displayingitaccordingtothespecifiedarguments;for
example,inhexadecimal(oftenusefulinconjunction
withdiff)
paste mergesamelinesofseveralfilesor
subsequentlinesofonefile
pr producesaprintedlistingofoneormorefiles
suitableforprinting
pwd printcurrentworkingdirectory
rm removethespecifiedfile(s);usingthe-rfflag
allowsadirectorytoberemoved1
sort sort,mergeorsequencechecktextfiles
split splitafileintopieces
tail displaysthelastlinesofthespecifiedfile(s)
tail -f file outputthecontentsoffileasit
grows,startingwiththelast10lines
touch changefileaccessandmodificationtimes;
canbeusedtocreateanew0byte(empty)file
tr translatecharactersfromonestringtoanother
uniq reportorfilteroutrepeatedlinesinafile
wc displayacountoflines,wordsandcharactersin
afile
SSH&SecureFileCopying
scp copiesfilesbetweenhostsonanetwork
sftp aninteractivefiletransferprogram
ssh user@host connectto hostasuser
ssh-copy-id user@host addyourkeyto
hostforusertoenableakeyedorpasswordless
login
ProcessManagement
at/batchexecutecommandsatalatertime
bg listsstoppedorbackgroundjobs;resumea
stoppedjobinthebackground
cron clockdaemonthatexecutescommandsat
specifieddatesandtimes
crontab modifiestheuser'scrontabfile,whichis
usedbycron
fg bringsthespecifiedjobtoforeground
kill pid killprocessid pid
killall proc killallprocessesnamedproc1
nice invokeacommandwithanalteredscheduling
priority
ps displayyourcurrentlyactiveprocesses
renice alterpriorityofrunningprocesses
top displayallrunningprocesses
File&GroupPermissions
Searching
grep searchforapatterninthespecifiedfiles
command | grep patternsearchforpattern
intheoutputofcommand
find file findallinstancesoffile (UNIX)
locate file findallinstancesoffile
xargs constructargumentlistsandinvokeutility
Compression
Youcanfindanumberofcompressionand
decompressionutilities.Checkthemanpagesfortar,
compress/uncompress,gzip/gunzipand
zip/unzip.Othersarealsoavailable.
UNIX/LINUXCommandReferenceSheet
VersionControl
Seethemanualpagesforcvs,svnorrcs.
SystemInformation
absolute (CSCF/MFCFonly)convertfilenamesto
absolutepathnames
absolute `which app` (CSCF/MFCFonly)
showthefullpathtothe appthatwillberunby
default
cal showthismonth'scalendar
chfn changetheuser'sfingerinformation
date showthecurrentdateandtime
diskquota (CSCF/MFCFonly)displaytheuser's
diskquota
du showdiskusageofeachfile,recursively
finger user displayinformationabout user
history displaysthelistofrecentlyentered
commands
hostselect consultaconfigurationfiletoreturn
anoptimalhostnamebaseduponthespecified
attribute
lpr submitaprintrequest
lpq displaythecontentsofaprintqueue
man command showthemanualforcommand
mesg permitordenymessages
passwd changetheuser'spassword
ruptime showcurrentuptimeofotherhosts
uname -a showkernelinformation
uptime showcurrentuptime
w displaywhoisonline
whereis app showpossiblelocationsofapp
which app showwhichappwillberunbydefault
whoami whoyouareloggedinas
Compilation&Debugging
ddd graphicalfrontendtogdb
gcc GNUprojectCandC++compiler
g++ frontendtogcctoexplicitlycompileC++code
gdb GNUdebugger
gmake GNUversionofmake
make utilitytomaintaingroupsofprograms
xxgdb graphicalfrontendtogdb;existsoncpulinux
GenerallyUsefulTools
MFCF FAQ locatedat
http://webtest.mfcf.uwaterloo.ca/wiki/index.php/
MFCF_FAQ
http://www.cs.uwaterloo.ca/cscf/student/hosts
alistoftheserversavailableintheundergraduate
environment,highlightingtheroundrobinserver
names(recommendedforaccesstoaparticularserver
type)
.snapshot (CSCF/MFCFonly)Abackupsystemis
inplaceinthestudent.mathandstudent.cs
environmentswherehourly,daily,weeklyand
monthlybackupsaremade.See
http://webtest.mfcf.uwaterloo.ca/wiki/index.php/
Snapshots
alias createapseudonymforacommandor
seriesofcommands
aproposlocatecommandsbykeywordlookup
clear cleartheterminalscreen,ifpossible
dos2unixconverttextfilefromDOSformattoISO
format
init_home (CSCF/MFCFonly)reinitializeyour
homedirectory
ispell interactivespellingchecking
lock lockaterminalwhenyouareaway
man ascii displaysthemapoftheASCII
characterset
oed lookthingsupintheOxfordEnglishDictionary
script makesatypescriptofeverythingprinted
onyourterminal.
scriptfix cleanupscriptoutputfiles
spell outputswordsfromthenameddocuments
thatarenotinthespellinglistnorderivablefrom
wordsinthespellinglist
unalias removeapseudonymforacommandor
seriesofcommands
unix2dos converttextfilefromISOformatto
DOSformat
xlocklocksthelocalXdisplayuntilapasswordis
entered
Shortcuts
Ctrl+C haltsthecurrentcommand
Ctrl+Z stopsthecurrentcommand,resumewith
fgintheforegroundorbginthebackground
Ctrl+D logoutofcurrentsession,similarto
exit;usedtosignalendoffilewhenrunningan
applicationthatreadsfromstandardinput
Ctrl+W erasesonewordinthecurrentline
Ctrl+U erasesthewholeline
Ctrl+R typetobringuparecentcommand
^pre1^pre2 repeatsthelastcommandwith
leadingtextpre1replacedwithpre2
!:gs/pre1/pre2repeatsthelastcommandwith
alloccurrencesoftextpre1replacedwithpre2
!! repeatsthelastcommand
!comrepeatsthemostrecentcommandenteredthat
canbeuniquelyidentifiedasstartingwithcom
!num repeatsthecommandnumberednum
exit logoutofcurrentsession