Professional Documents
Culture Documents
Bite Size Command Line
Bite Size Command Line
t.to sis n
asHieiseEoaseFIsqf
ns
Julia
Even
Table of contents
grep
Xargs
7 ps 14 kill 20
If
Iggy 4
FE CTUhyphae
2 versions
g rep 5
grep
grepbananas too.tt
theurfurairfesgormeepcootmmmasnd
linearguments
Hairlines
match
that don't Thea'T.hn 9nPoatrtthoet
whole line
searchbinaries
Showcontextforyour
search
f f it eafmasgfedthefites QaTireEtifisnaIeIfiatsatea
ofignoringit.fr
willshow3lines of
contextafter a match
hyp
aka eg grep F o
f Emfack Efag ErmmTipgrep
betterforsearchingcode.o
find 6
find searches a name I name
f 1
foirectaorcq whichfiles acutifhntondeo
files pthNUM
pathfipath f only
herearemyfavouri
findarguments path home1 1 go whensearchinga directory
createdbyaccident tem
om
ebadsaII
foeTete
can getoutofdate
action run COMMAND on action delete allfilesfound Sudo updatedb
xargs
Xargs
separated strings from want to run the same with bar in all txt
I xargs IS
will run
to combinelxargscat
Xargs sed i sHoo1barIg
search leargs grep
how
xargspep8
f fix it likethis f capitalto
forseepaacrhatenpprof.es
args 0
COMMAND MaxPro's
AWK 8
awk is a
tiny basic awk program extract a column
for manipulating
f condition action
CONDITION action column
ro
separator
p g
fingerprintthe
f
to do 2 things
A stilluseful.tt
CONDITION
SO
MANY unix commands every
print
columns of the 3rd column 80 characters
so
the
being able to get
column you want
f i est
l END
1
f
33 i
prints i I EIIIEIIII.IE
tcondition
there's an implicit
I
Sed a
incantationsI
Sed
is most often change a file in place some more sed
used for
sedsq.atdog gfi H q
e nngggseeqiiss print mine
everytime onlywhatyouprintwith.pl
rexpression getsprinted
deletesthline use
canbeanycharacter
as regexdelimeter
a lgoodforlongerrorli
doublespace a file
containing
sed n5 sed nscatTgp
JP
i7panda
bash tricks
to
searchYourhistory sudo
expands to
more keyboardshortcuts
loops 1
Png command
end of line
doconuerts
done
i pg
touch file date I ftrite
Ctrl11 clear the screen
ga
Es create a file named lots more emacs
bash
more tricks 11
Cd Ctrl 12
bg
ni9am
were
directoryyou
last in
fashellcheckT
C fc type
process substitution
fix command
tellsyou if something is
mi e
diff us us a
Itdifferentypest
disk usage 12
tells
du Jf
tells you howmuchfree spaceeach
partition has 4T for human readablesizes
you howmuch disk
space files 1directoriestakeup Filesystem Size Used Avail Use Mounted on
EB summary total
f
size of all files in
roevsoas Iso o 2 so sooo i
a directory
Ude 483M 4 Ok 483M 1 Idev
D humanreadable
sizes
tmpts 99M 1.4M 97M 2 lean
dev sda4 167615709.96953
of i ncdu iostat
see what's using diskspace statistics about
instead of diskfree
navigatewith arrow keys get
disk reads1
reporthow manyinodes writes
are used free on each
partition
f h.sa.BE
3.2 GiB E
music
31pictures Iostat 5
intervaitoreportat
5 7 MiB E 31 text Device KB reaorskBerrtnis
OIj ninseuqtIftygyga
raihneonfign.gs
tar 13
combines
manyfiles the tar command you
uTiIEttirc.ttffounpackatarsz.use thaw
7aPieyssedwbgtihpemsneek.es
w at
Er makes a new tarsier
tar gzor.tgz.lk
decompress
pzforma c.bzz
ey
J xz format l iz
tar czf file targz dirt
or unpack inte
PS
14
ps w wchan
f
ps
x is sleeping
umeansinclude tongewthair is for environment ps auxe
whattheletters in psauxf
ps's STATEcolumn means will showyou an ASCII art 1 UNIX l 1 dash
If I
Process tree
Biorinnaisngeep
2 zombie
f Pstree can display
3.3
youcan
4
write
Yes
monstrosities like
a processtree too f
l multithreaded ps f
intheforeground
F fullformat
forestCBSD unix
top
15
liveupdating summary of
a 3 numbers that roughly 4numbers
the topusers of your
reflect demand for your
system's
resources go.ns.taheosystem.mn.in the spiteIIhiidng
onetopteInaHpsreuYe
total is notfree used
meytop if itis higherthanthe
1 memory
total free usedtgched
ofCPUsyouhave that's
let's
explainsomenumbers intop oftenbad filesystem
CPU RES htop
what7T
35oro
ooo thiscolumn is the resident
setsize aka howmuch
a prettier moreinteractive
version oftop
RAMyour process is
hiscolumn is givenas of
a singlecore If youhave
f using
iexam
24111mmol
3EM
20
4 cores this can go up SHR is how much of the cached
5 3
yaw jsed 5
to yoo RES issharedwithother menHmmmmmmmm mm y o
sort
16
unig
numeric sort
sort names.tt
n
iz
15000
ii
i
iz
48 f h
it
som
45K
2000
i son
156
I du sh I sort h
unig
b
Ar are still 2 sort unig'andyou'll Recipe getthetop 10most
b
b a'sr.um.ci getadedupiicateoiist commoniinesinatiie
c adjacent
matchinglines
sbamething
a 1 sort u
a
b
lunig
1 sort n
c
j yE
c b p l tail n lo
t
misc commands
17
rt wrap watch pv
don't
alreadyhave them
http EIE I
fi
t i
eisll a
tin's oar
1 s nadu diff
I
add a timestamp in front figure out whatisusing diff 2 files Run with
I
fiance effmmsoonrted files
from system
head tail 18
showsyou the first tail showsthe last 10lines n NUM eitherhead or tail
f gmmftaiwmeo.ee
showthe first Nast NUM keeptrying to open µ Usually tail f will follow
uenanef
a fouow name
head
ftp
will keepfollowingthesame
filename
eg if the file
less
19
less is a
pager many Vim shortcuts less r
uoirejipenootinefiet.IT files
search codes as colours
man
pages t
Igginvim
a
tft
red
92 Col31mAtxt.gz
Esccom
9 F t
II
eoitfiieinya.rs or
right
Kill 20
kill doesn't
just kill whichsignal kill sends kill 1
f
5Trap 6 ABRT 7 Bus 8 EPE
t hiiii.int
kill Hop
ua
SIGHUP 1
ii i i ii iiiii
Matus 18CONT 19stop zorstp
2ITTIN 221100 23
nameornumber
signalsallprocessescalledNAME
pgrep
prints MDs ofmatching
pkill
same as pgrep butsignals
firefox
useful
akgils.la
f pgrepfiremantoghesasnfiqffff.sn
pkiu.ffirefox µ
eosaroitetsosresatosoisienated
teforesignalling
cat friends 21
EXTREMELYBASIC text
typethecontents don'tmake
together
cats a gzipped file tee file txt will write sudoecho hi x txt
Ashatfalyripifsthaaf fines
Cd but easier
f stout and file.tt
stdout
Hthswii open as your
user not as root so itfails
Is of
22
foreachopenfile
tepid open
et're't.EE45ocEiItoy
Ti s
r filedescriptor CFDcolumn
somer
Icante Iffileername
socketaddress
in Isomeldir
listopennetworksockets
ex sockets on Linuxis
p name.nl
don'tresolve
filesfrom
roeote
iii
o netsta tunap
7
f
i Gogo hostnamesIports
s
tunaplease.r
also Pni lproclapio Ifdlefd
sponge join
xxd parallel
objdump pigzipixz
love this
jvns.ca zines
Ac