ans 10 akancod inoxconrran line tools | A dayintho ie of
‘Teicha,
emulon PUPS S
TeyCatchFinay
10 advanced linux command line tools
Novwenber24, 2010
By Josh Thissen
“Most dovlopers who are working a the command ine on a Linux system know the “basi
commands, ed a esl, sort, ep, i an ots, More “advanced” wsers wil
owe to del wah the “se and “awk” beats, or even prefer per-oneines, ave the knowiedge
‘hash (scrips) and you ad yousel aie a Vala where only your again iste
fe, Well mot really, but at east you got my po, hope
you don't know abou the thing ht Iss afer the horn wil
you acumlly explore tem This “et another tp tn It” wl dive nto some teresting
andar) oo tht can make you it much ease when dealing wi Linx systems ffoma.
programmers perspec
#1
watch
‘watch a beautiil progrars ht executes a program periodically an outputs the contents on
{il seren, Ifyou place you comand ise quotes, you can even un matpl commands
This command executes fle tng, ouuts m:mory stats ened disk pace, ll sepaared by
cmply ns ad repeats it every second. How easy it fr youto watch age es pes copied
fd keep an eye out ar dik space sus
#
curl
Most (PHP) developers akeady have met the eUIRL php extension inthe Ht, bt his tools
ako avaibble on your command Ine. Istad of wring an dona pp-program just or doing
som ‘cis’, just use the commend ne tool Alloptions you need are sabe, Just
‘Seu “an cr”and Sind ot bora the possi
#8: logsave
Jogsave ia very nic tool hat captures the ouput ofa programand sends too a bg. I's
des, only wiladd a begin ime samp and a end tne
stanp:
cael! 2010128" 0-acenced- trae command:-tine-aos!
28ans 10 akancod inoxconrran line tools | A dayintho ie of
sof
‘bofstunds fr “st open es" and dsphys al the es hat your systems curently opened
Ws very wef to igre out which processes uses a cetan f,oro diy alte fies for 2
sige process:
Stave & one oft vores. traces al system call that a program makes to the Sng kena
‘This means you can actly “see” when a program opens, ebss, reads, wre, acess fs but
offcourse, thee are much more cal tat you ean trace. I's ke runing a progr witout i's
strae ff-0 tace-open asrsbnvapache2
"his wit stace the program ‘xpache2" and outpus al th open-cal, Anober used version
trace l-p
‘races the cueny rung process tast.2sp
fegsyoraen /4 tile test
Gguyorish /]# coat testicip
#4: od
Ws not oo ing ago T discovered this tol myself It can dunp a fle it diferent kindof
ocr
gayarush /]4 acho *holls varia" > tost.exe
Guyorueh /14 od teat-txt
gayorush /1# od == xe cest.tee
AN ode xtute tone cext
#3: iconv
‘conv ita reat to! forallthose tines you nce to convert feta s encoded one way to
comer co ansier fora, For insane, ti dump ofa MySQL. database ha eed to be
‘nported ito asthe database thats UTF-8 encoded, Ieony can o-dtect ce curent
fmt, Together with dis tool saved my ie recemly, when somebody mined wp curse
encodings so £8 mulbytechuracters were actualy encoded AGAIN as we characters,
#2: ne
ota (2) the tepip swish amy ka. I's capable oF alos everthing except washing your
car and making cof, although the stones disputed by some. [use this ab or checking
serve requests (lke soap-cens) to see they actualy send out the correct headers
sup stein server"
point your sogp-cet to send data to hp/27.0.0.1:12545 and see the data thats being send
fom your chen.
Another common we, bu mot so mich nowadays, since i's taken ove by sep, i daa
sransering
‘Opena Istering conection ana cent ad opti dala oa fe:
cone second server (wre your tie resis) transfer the data to the efont
‘This wi wun the data to te cert As said using "scp server plata dat” probably a
such bet idea nowadays
‘There i amch, mach mre you ca do wih ecat Use tin shel serps to tak to servers (ie
Jastance:smtp or hep or IRC servers) deel. Agate the mana is your fen
#1: whiptail
wn eteoo 12011 24 -acanced- ncaa!ans 10 adancod inoxconrrand line too | A dayin the too
‘Ifyou esa ub, conos, debian or hascaly ay ta favor sro that doesnt spawn a
srapical sell you cr up ina kind ofewuainefice . These bis sereen are perfect for
‘quek browsing through instalation options But dl you know i's jus as easy for yout wse for
yor owntook?
ample:
1s just so easy to erate nic ite dsply box: sta the text, the height art width nd
optionally te. msure yourecugsize the iertace during sation o kere upgrades)
A sample messagebox
‘Ask awser any gestion. til etam the stan code 1 r“no" a sta code 0 Sr"Ses".
Lyeoro "Are you sure you nant to continue vith deployment?” \
‘A yesno diab with he deat btton set to "ho"
“Menuboxes ares to him’ select boxes, Add ems and el the user choose betwen ther
wanda 201011 124!10-advaned-n-comeranéine oo!ans 10 akancod inoxconrran line tools | A dayintho ie of
eel
A mem wet user pick anim quickly
Gauges ate a pero way ofleting the utr kaow te stats of whatever you aze doing Lfyour
program hat you wil ran inthe background can ouput percentage, whipal picks tha up and
Alipay the comet perceriage on he seeon nthe example, | use a simple counter fom 0 to
100 witha i sceond delay. You walse the progress-bar llup unt reaches 10
even got gauges!
‘There are mote kind of digs you can create with whip, read the man pages and fd out
just how easy tf make your took wer fiendly. Grab al tgs from your sym repository wit
"Sn, place tem na mena wit “wiptal-era” and mae your i jus il ese.
Conclusion
Len (ofbeter sail unin) philosophy of do only one thin and do # good” works, However,
this crates a massive forest of ools where evn the most experince users dont know wit
cach commando does so don't despa. Know your wok and the job hada so poke
sou inthe mar-pages, sin and Juscsbin directories and fd out what other gems re stil
arousal far yout discover,
(D Share/Seve 09S
Toe: ausisls
‘One Response to 10 advanced linux command line tools
_
a
doo! Bajwa
Novenber20, 2012 31 0638
Loved ipa, Thanks for shar
Realy
Leave a Reply
a cayethelifoo! 2010128" 0-acenced- trae command-tine-taos!
ct