You are on page 1of 2

12/1/2014

Unix/LinuxCheatSheet

CHEATSHEETWORLD
>All>Programming>Unix/LinuxCheatSheet

UNIX/LINUXCHEATSHEET

29
Tweet

19

20

Like

48
Share

FILESYSTEM

SYSTEM

PROCESSMANAGEMENT

ls listitemsincurrentdirectory

shutdown shutdownmachine

ps displayyourcurrentlyactiveprocesses

lsl listitemsincurrentdirectoryandshowinlong
formattoseeperimissions,size,andmodificationdate

reboot restartmachine

top displayallrunningprocesses

date showthecurrentdateandtime

killpid killprocessidpid

lsa listallitemsincurrentdirectory,including
hiddenfiles

whoami whoyouareloggedinas

kill9pid forcekillprocessidpid

lsF listallitemsincurrentdirectoryandshow
directorieswithaslashandexecutableswithastar

mancommand showthemanualforcommand

lsdir listallitemsindirectorydir
cddir changedirectorytodir
cd.. gouponedirectory
cd/ gototherootdirectory
cd~ gototoyourhomedirectory
cd gotothelastdirectoryyouwerejustin

fingeruser displayinformationaboutuser

df showdiskusage
du showdirectoryspaceusage
free showmemoryandswapusage
whereisapp showpossiblelocationsofapp
whichapp showwhichappwillberunbydefault

PERMISSIONS
lsl listitemsincurrentdirectoryandshow
permissions

chmodugofile changepermissionsoffiletougo
uistheuser'spermissions,gisthegroup'spermissions
andoiseveryoneelse'spermissions.Thevaluesofu,g
andocanbeanynumberbetween0and7.

NETWORKING

7 fullpermissions

mkdirdir makedirectorydir

wgetfile downloadafile

5 readandexecuteonly

rmfile removefile

curlfile downloadafile

4 readonly

rmrdir removedirectorydirrecursively

scpuser@host:filedir securecopyafilefrom
remoteservertothedirdirectoryonyourmachine

3 writeandexecuteonly

recursively

scpfileuser@host:dir securecopyafilefrom
yourmachinetothedirdirectoryonaremoteserver

1 executeonly

mvfile1file2 move(rename)file1tofile2

scpruser@host:dirdir securecopythe

pwd showpresentworkingdirectory

cpfile1file2 copyfile1tofile2
cprdir1dir2 copydirectorydir1todir2

lnsfilelink createsymboliclinktofile
touchfile createorupdatefile
catfile outputthecontentsoffile
lessfile viewfilewithpagenavigation
headfile outputthefirst10linesoffile

sshuser@host connecttohostasuser

chmod700file youcanread,write,andexecute
goodforscripts

sshpportuser@host connecttohostonportas
user

tailffile outputthecontentsoffileasitgrows,

pinghost pinghostandoutputresults

startingwiththelast10lines

whoisdomain getinformationfordomain

vimfile editfile

digdomain getDNSinformationfordomain

aliasname'command' createanaliasfora
command

digxhost reverselookuphost
lsofitcp:1337 listallprocessesrunningonport
1337

COMPRESSION

tarczffile.tar.gzfiles createatarwithGzip
compression
tarxzffile.tar.gz extractatarusingGzip

0 nopermissions
chmod600file youcanreadandwritegoodfor
files

sshcopyiduser@host addyourkeytohostfor
usertoenableakeyedorpasswordlesslogin

tarxffile.tar extractthefilesfromfile.tar

2 writeonly

directorydirfromremoteservertothedirectorydiron
yourmachine

tailfile outputthelast10linesoffile

tarcffile.tarfiles createatarnamedfile.tar
containingfiles

6 readandwriteonly

chmod644file youcanreadandwrite,and
everyoneelsecanonlyreadgoodforwebpages
chmod755file youcanread,write,andexecute,
andeveryoneelsecanreadandexecutegoodfor
programsthatyouwanttoshare

SEARCHING
greppatternfiles searchforpatterninfiles
greprpatterndir searchrecursivelyfor
patternindir

SHORTCUTS

greprnpatterndir searchrecursivelyfor
patternindirandshowthelinenumberfound

ctrl+a movecursortobeginningofline

greprpatterndirinclude='*.ext search
recursivelyforpatternindirandonlysearchinfileswith
.extextension

ctrl+f movecursortoendofline
alt+f movecursorforward1word
alt+b movecursorbackward1word

command|greppattern searchforpatterninthe
outputofcommand

gzipfile compressesfileandrenamesittofile.gz

findfile findallinstancesoffileinrealsystem

gzipdfile.gz decompressesfile.gzbacktofile

locatefile findallinstancesoffileusingindexed
databasebuiltfromtheupdatedbcommand.Muchfaste
thanfind

sedi's/day/night/g'file findall
occurrencesofdayinafileandreplacethemwithnight
smeanssubstitudeandgmeansglobalsedalso
supportsregularexpressions

http://cheatsheetworld.com/programming/unixlinuxcheatsheet/

1/2

12/1/2014

Unix/LinuxCheatSheet

EditthisCheatSheet
onGithub
MORECHEATSHEETS

0Comments

CheatSheetWorld

Login

Share Favorite

SortbyBest

Startthediscussion

Bethefirsttocomment.

WHAT'STHIS?

ALSOONCHEATSHEETWORLD

HTML5CanvasCheatSheet

GameofThronesCheatSheet

8comments7monthsago

2comments7monthsago

FrankBGoodjob!

ericdrowellAgreed.Althoughthepointofthischeatsheetistocleanly

organizecharactersbyhouseandprovideshortdescriptons.Tree
diagramsdon'tscaleverywellwithlotsofcharacters.Theyarealso
hardtonavigateonmobiledevices.

Subscribe

AddDisqustoyoursite

Privacy

http://cheatsheetworld.com/programming/unixlinuxcheatsheet/

2/2

You might also like