You are on page 1of 12

20 Advanced Commands for Middle Level Linux Users

By Avishek Under: Linux Commands On: May 23, 2013 You migh have !ound he !irs ar i"#e very mu"h use!u#, his ar i"#e is an ex ension o! he 20 Use!u# Commands !or Linux $e%&ies' (he !irs ar i"#e %as in ended !or ne%&ies and his ar i"#e is !or Middle-Level-User and Advanced Users' )ere you %i## !ind ho% o "us omise sear"h, kno% he *ro"esses running guide o ki## hem, ho% o make your Linux ermina# *rodu" ive is an im*or an as*e" and ho% o "om*i#e c, c++, java *rograms in nix' 20 Linux Advan"ed + ,x*er Commands

21. Command: Find


-ear"h !or !i#es in he given dire" ory, hierar"hi"a##y s ar ing a he *aren dire" ory and moving o su&.dire" ories'
root@tecmint:~# find -name *.sh ./Desktop/load.sh ./Desktop/test.sh ./Desktop/shutdown.sh ./Binary/firefox/run-mo illa.sh ./Downloads/kdewe!de"-#.$.%/&uanta/scripts/externalpre"iew.sh ./Downloads/kdewe!de"-#.$.%/admin/doxy'en.sh ./Downloads/kdewe!de"-#.$.%/admin/c"s.sh ./Downloads/kdewe!de"-#.$.%/admin/ltmain.sh ./Downloads/whee y-n"-install.sh

No e: (he /-name0 o* ion makes he sear"h "ase sensi ive' You "an use he /-iname0 o* ion o !ind some hing regard#ess o! "ase' 1! is a %i#d"ard and sear"hes a## he !i#e having ex ension 0.s"0 you "an use !i#ename or a *ar o! !i#e name o "us omise he ou *u 2'
root@tecmint:~# find -iname *.() * find -iname *.(h / find -iname *.s)+

./Desktop/load.sh ./Desktop/test.sh ./Desktop/shutdown.sh ./Binary/firefox/run-mo illa.sh ./Downloads/kdewe!de"-#.$.%/&uanta/scripts/externalpre"iew.sh ./Downloads/kdewe!de"-#.$.%/admin/doxy'en.sh ./Downloads/kdewe!de"-#.$.%/admin/c"s.sh ./Downloads/kdewe!de"-#.$.%/admin/ltmain.sh ./Downloads/whee y-n"-install.sh root@tecmint:~# find -name *.tar.' /"ar/www/modules/update/tests/aaa,update,test.tar.' ./"ar/cache/flashplu'in-nonfree/install,flash,player,--,linux.i#%..tar.' ./home/ser"er/Downloads/drupal-/.00.tar.' ./home/ser"er/Downloads/smtp-/.x--.1.tar.' ./home/ser"er/Downloads/nore&newpass-/.x--.0.tar.' ./usr/share/'ettext/archi"e.'it.tar.' ./usr/share/doc/ap'/php.tar.' ./usr/share/doc/festi"al/examples/speech,pm,-.1.tar.' ./usr/share/doc/ar'yll/examples/spyder0.tar.' ./usr/share/us!,modeswitch/confi'2ack.tar.'

Page1

No e: (he a&ove "ommand sear"hes !or a## he !i#e having ex ension 0 ar.#$0 in roo dire" ory and a## he su&.dire" ories in"#uding moun ed devi"es' 3ead more exam*#es o! Linux 0find0 "ommand a 34 5ind Command ,xam*#es in Linux

22. Command: #re%


(he 0#re%0 "ommand sear"hes he given !i#e !or #ines "on aining a ma "h o he given s rings or %ords' -ear"h 0&e c&%ass'd0 !or 0 ecmin 0 user'
root@tecmint:~# 'rep tecmint /etc/passwd tecmint:x:-111:-111:3ecmint444:/home/tecmint:/!in/!ash

6gnore %ord "ase and a## o her "om&ina ion %i h 0-i0 o* ion'
root@tecmint:~# 'rep -i 3567893 /etc/passwd tecmint:x:-111:-111:3ecmint444:/home/tecmint:/!in/!ash

-ear"h re"ursive#y 1-r2 i.e. read a## !i#es under ea"h dire" ory !or a s ring 712(.0.0.17'
root@tecmint:~# 'rep -r :-0/.1.1.-: /etc/ /etc/"lc/lua/http/.hosts:-0/.1.1./etc/speech-dispatcher/modules/i"ona.conf:#8"ona(er"er)ost :-0/.1.1.-: /etc/mys&l/my.cnf:!ind-address ; -0/.1.1./etc/apache0/mods-a"aila!le/status.conf: <llow from -0/.1.1.- ::/etc/apache0/mods-a"aila!le/ldap.conf: <llow from -0/.1.1.- ::/etc/apache0/mods-a"aila!le/info.conf: <llow from -0/.1.1.- ::/etc/apache0/mods-a"aila!le/proxy,!alancer.conf:# <llow from -0/.1.1.- ::/etc/security/access.conf:#= : root : -0/.1.1./etc/dhcp/dhclient.conf:#prepend domain-name-ser"ers -0/.1.1.-> /etc/dhcp/dhclient.conf:# option domain-name-ser"ers -0/.1.1.-> /etc/init/network-interface.conf: ifconfi' lo -0/.1.1.- up ?? true /etc/@a"a-.-open@dk/net.properties:# localhost A -0/.1.1.-+. /etc/@a"a-.-open@dk/net.properties:# http.non2roxy)osts;localhost?-0/.1.1./etc/@a"a-.-open@dk/net.properties:# localhost A -0/.1.1.-+. /etc/@a"a-.-open@dk/net.properties:# ftp.non2roxy)osts;localhost?-0/.1.1./etc/hosts:-0/.1.1.localhost

No e: You "an use hese !o##o%ing o* ions a#ong %i h #re%' 1' -' !or %ord 1egre* .% 0'ord18'ord20 9*a h9 o9!i#e2' 2' -c !or "oun 1i'e', o a# num&er o! imes he *a ern ma "hed2 1gre* ." 0'ord0 9*a h9 o9!i#e2' 3' )color !or "o#oured ou *u 1gre* )color server 9e "9*ass%d2'

2*. Command: man


(he 0man0 is he sys em:s manua# *ager' Man *rovides on#ine do"umen a ion !or a## he *ossi&#e o* ions %i h a "ommand and i s usages' A#mos a## he "ommand "omes %i h heir "orres*onding manua# *ages' 5or exam*#e,
Page1
root@tecmint:~# man man

7<9*-+ pa'er utils 9<75 man - an interface to the on-line reference manuals

7anual 7<9*-+

(B9C2(8( man D-6 fileE D-dE D-DE D--warnin'sD;warnin'sEE D-F encodin'E D-G localeE D-m systemD4...EE D-7 pathE D-( listE D-e extensionE D-i?-8E D--re'ex?--wildcardE D--names-onlyE D-aE D-uE D--no-su!pa'esE D-2 pa'erE D-r promptE D-/E D-5 encodin'E D--no-hyphenationE D--no-@ustificationE D-p strin'E D-tE D-3Dde"iceEE D-)D!rowserEE D-HDdpiEE D-IE DDsectionE pa'e ...E ... man -k Dapropos optionsE re'exp ... man -J D-w?-KE D-( listE D-i?-8E D--re'exE DsectionE term ... man -f Dwhatis optionsE pa'e ... man -l D-6 fileE D-dE D-DE D--warnin'sD;warnin'sEE D-F encodin'E D-G localeE D-2 pa'erE D-r promptE D-/E D-5 encodin'E D-p strin'E D-tE D-3Dde"iceEE D-)D!rowserEE D-HDdpiEE D-IE file ... man -w?-K D-6 fileE D-dE D-DE pa'e ... man -c D-6 fileE D-dE D-DE pa'e ... man D-hLE

Manua# *age !or man *age i se#!, simi#ar#y 0man ca 0 1Manua# *age !or "a "ommand2 and 0man ls0 1Manua# *age !or "ommand #s2' No e: man *age is in ended !or "ommand re!eren"e and #earning'

2+. Command: %s
%s 1,rocess2 gives he s a us o! running *ro"esses %i h a uni;ue -d "a##ed ,-.'
root@tecmint:~# ps 28D 33B M-/1 pts/N.0% pts/3875 67D 11:11:11 !ash 11:11:11 ps

(o #is s a us o! a## he *ro"esses a#ong %i h *ro"ess id and ,-., use o* ion 0-A0'
root@tecmint:~# ps -< 28D 33B - O 0 O # O $ O / O % O N O .... 3875 67D 11:11:1- init 11:11:11 kthreadd 11:11:1- ksoftir&d/1 11:11:11 kworker/1:1) 11:11:11 kworker/u:1) 11:11:11 mi'ration/1 11:11:11 rcu,!h

No e: (his "ommand is very use!u# %hen you %an o kno% %hi"h *ro"esses are running or may need ,-. some imes, !or *ro"ess o &e ki##ed' You "an use i %i h 0#re%0 "ommand o !ind "us omised ou *u ' 5or exam*#e,
root@tecmint:~# ps -< ? 'rep -i ssh -$11 O 11:1N:$% sshd

Page1

M#-/ O

11:11:11 sshd

)ere 0%s0 is *i*e#ined %i h 0#re%0 "ommand o !ind "us omised and re#evan ou *u o! our need'

2/. Command: 0ill


O<, you migh have unders ood %ha his "ommand is !or, !rom he name o! he "ommand' (his "ommand is used o ki## *ro"ess %hi"h is no re#evan no% or is no res*onding' 6 is very use!u# "ommand, ra her a very very use!u# "ommand' You migh &e !ami#iar %i h !re;uen %indo%s res ar ing &e"ause o! he !a" ha mos o! he ime a running *ro"ess "an: &e ki##ed, and i! ki##ed i needs %indo%s o ge res ar so ha "hanges "ou#d &e aken in o e!!e" &u in he %or#d o! Linux, here is no su"h hings' )ere you "an ki## a *ro"ess and s ar i %i hou res ar ing he %ho#e sys em' You need a *ro"ess:s *id 1*s2 o ki## i ' Le su**ose you %an o ki## *rogram 0a%ac"e20 ha migh no &e res*onding' 3un 0%s -A0 a#ong %i h #re% "ommand'
root@tecmint:~# ps -< ? 'rep -i apache0 -0%$ O 11:11:11 apache0

5ind *ro"ess 0a%ac"e20, no e i s %id and 0ill i ' 5or exam*#e, in my "ase 0a%ac"e20 *id is 0121/0'
root@tecmint:~# kill -0%$ *to kill the process apache0+

No e: ,very ime you re.run a *ro"ess or s ar a sys em, a ne% %id is genera ed !or ea"h *ro"ess and you "an kno% a&ou he "urren running *ro"esses and i s %id using "ommand 0%s0' Ano her %ay o ki## he same *ro"ess is'
root@tecmint:~# pkill apache0

No e: <i## re;uires jo2 id 9 %rocess id !or sending signa#s, %here as in %0ill3 you have an o* ion o! using *a ern, s*e"i!ying *ro"ess o%ner, e "'

24. Command: '"ereis


(he 0'"ereis0 "ommand is used o #o"a e he 5inar6, 7ources and Manual ,a#es o! he "ommand' 5or exam*#e, o #o"a e he 5inar6, 7ources and Manual ,a#es o! he "ommand 0ls0 and 00ill0'
root@tecmint:~# whereis ls ls: /!in/ls /usr/share/man/man-/ls.-.' root@tecmint:~# whereis kill kill: /!in/kill /usr/share/man/man0/kill.0.' /usr/share/man/man-/kill.-.'

No e: (his is use!u# o kno% %here he &inaries are ins a##ed !or manua# edi ing some imes'
Page1

2(. Command: service

(he 0service0 "ommand "on ro#s he 7 ar in#, 7 o%%in# or 8es ar in# o! a 0service0' (his "ommand make i *ossi&#e o s ar , res ar or s o% a servi"e %i hou res ar ing he sys em, !or he "hanges o &e aken in o e!!e" ' 7 ar in# an a%ac"e2 server on U2un u
root@tecmint:~# ser"ice apache0 start * (tartin' we! ser"er apache0 apache0: 6ould not relia!ly determine the ser"erPs fully &ualified domain name4 usin' -0/.1.-.- for (er"er9ame httpd *pid -0%$+ already runnin' D CJ E

8es ar in# a a%ac"e2 server on U2un u


root@tecmint:~# ser"ice apache0 restart * Festartin' we! ser"er apache0 apache0: 6ould not relia!ly determine the ser"erPs fully &ualified domain name4 usin' -0/.1.-.- for (er"er9ame ... waitin' .apache0: 6ould not relia!ly determine the ser"erPs fully &ualified domain name4 usin' -0/.1.-.- for (er"er9ame D CJ E

7 o%%in# a a%ac"e2 server on U2un u


root@tecmint:~# ser"ice apache0 stop * (toppin' we! ser"er apache0 apache0: 6ould not relia!ly determine the ser"erPs fully &ualified domain name4 usin' -0/.1.-.- for (er"er9ame ... waitin' D CJ E

No e: A## he *ro"ess s"ri* #ies in 0&e c&ini .d0, and he *a h migh needs o &e in"#uded on "er ain sys em, i'e', in s*i e o! running 7service a%ac"e2 s ar = you %ou#d &e asked o run 7service &e c&ini .d&a%ac"e2 s ar ='

21. Command: alias


alias is a &ui# in she## "ommand ha #e s you assign name !or a #ong "ommand or !re;uen #y used "ommand' 6 uses 0ls -l0 "ommand !re;uen #y, %hi"h in"#udes / "hara" ers in"#uding s*a"e' )en"e 6 "rea ed an a#ias !or his o 0l0'
root@tecmint:~# alias l;Pls -lP

"he"k i! i %orks or no '


root@tecmint:~# l total #. drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x # # 0 % tecmint tecmint tecmint tecmint tecmint tecmint tecmint tecmint M1N. M1N. M1N. M1N. 7ay 7ay 7ay 7ay -1 0001 --:-M --:0-$:0# -M:$. Binary Desktop Documents Downloads

Page1

drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x

0 0 0 0 0

tecmint tecmint tecmint tecmint tecmint

tecmint tecmint tecmint tecmint tecmint

M1N. M1N. M1N. M1N. M1N.

7ay / -.:$% 7usic 7ay 01 -.:-/ 2ictures 7ay / -.:$% 2u!lic 7ay / -.:$% 3emplates 7ay / -.:$% Lideos

(o remove a#ias 0l0, use he !o##o%ing 0unalias0 "ommand'


root@tecmint:~# unalias l

"he"k, i! 0l0 s i## is a#ias or no '


root@tecmint:~# l !ash: l: command not found

Making a #i #e !un ou o! his "ommand' Make a#ias o! "er ain im*or an "ommand o some o her im*or an "ommand'
alias cd;Pls -lP *set alias of ls -l to cd+ alias su;PpwdP *set alias of pwd to su+ .... *Bou can create your own+ ....

$o% %hen your !riend y*es 0cd0, >us hink ho% !unny i %ou#d &e %hen he ge s dire" ory #is ing and no dire" ory "hanging' And %hen he ries o &e 0su0 he a## he ge s is he #o"a ion o! %orking dire" ory' You "an remove he a#ias #a er using "ommand 0unalias0 as ex*#ained a&ove'

29. Command: df
3e*or disk usages o! !i#e sys em' Use!u# !or user as %e## as -ys em Adminis ra or o kee* ra"k o! heir disk usages' 0df0 %orks &y examining dire" ory en ries, %hi"h genera##y are u*da ed on#y %hen a !i#e is "#osed'
root@tecmint:~# df Qilesystem /de"/sdanone ude" tmpfs none none none /de"/sda$ /de"/sda/ /de"/sda% -J-!locks Rsed <"aila!le RseS 7ounted on M/N0N00M /%--N1% #/./$NM% -%S / M 1 M 1S /sys/fs/c'roup -11$N-. M -11$N-0 -S /de" 010%0M %-. 01011% -S /run $-01 1 $-01 1S /run/lock -1-M-01 .0% -1-#MN0 -S /run/shm -10M11 MM -10#$. -S /run/user -%M#1/ /N%$0 NM/0/ M.S /!oot N$N%N$-. .--1M N-1M$./. -S /data N-N$#-N0 $/1#0 %/0-%$0% -S /personal

5or more exam*#es o! 0df0 "ommand, read he ar i"#e 12 d! Command ,xam*#es in Linux'

*0. Command: du
,s ima e !i#e s*a"e usage' Ou *u he summary o! disk usages &y ever !i#e hierar"hi"a##y, i'e', in re"ursive manner'
root@tecmint:~# du

Page1

% % #0 % % 0% #0 #. $%1 -M$. #. -.-%1 -0 M.#0

./Daily 2ics/wp-polls/ima'es/default,'radient ./Daily 2ics/wp-polls/ima'es/default ./Daily 2ics/wp-polls/ima'es ./Daily 2ics/wp-polls/tinymce/plu'ins/polls/lan's ./Daily 2ics/wp-polls/tinymce/plu'ins/polls/im' ./Daily 2ics/wp-polls/tinymce/plu'ins/polls ./Daily 2ics/wp-polls/tinymce/plu'ins ./Daily 2ics/wp-polls/tinymce ./Daily 2ics/wp-polls ./Daily 2ics ./2lu'ins/wordpress-author-!ox ./2lu'ins ./7ay <rticles 01-#/Htreme Download 7ana'er ./7ay <rticles 01-#/H6ache

No e: 0df0 on#y re*or s usage s a is i"s on !i#e sys ems, %hi#e 0du0, on he o her hand, measures dire" ory "on en s' 5or more 0du0 "ommand exam*#es and usage, read 10 du 1?isk Usage2 Commands'

*1. Command: rm
(he "ommand 0rm0 s ands !or remove' rm is used o remove !i#es 1s2 and dire" ories' 8emovin# a direc or6
root@tecmint:~# rm 2assport<pplicationQorm,7ain,5n'lish,L-.1 rm: cannot remo"e T2assport<pplicationQorm,7ain,5n'lish,L-.1P: 8s a directory

(he dire" ory "an: &e removed sim*#y &y 0rm0 "ommand, you have o use 0-rf0 s%i "h a#ong %i h 0rm0'
root@tecmint:~# rm -rf 2assport<pplicationQorm,7ain,5n'lish,L-.1

:arnin#: 7rm -rf= "ommand is a des ru" ive "ommand i! a""iden #y you make i o he %rong dire" ory' On"e you 0rm -rf0 a dire" ory a## he !i#es and he dire" ory i se#! is #os !orever, a## o! a sudden' Use i %i h "au ion'

*2. Command: ec"o


ec"o as he name sugges e"hoes a ex on he s andard ou *u ' 6 has no hing o do %i h she##, nor does she## reads he ou *u o! e"ho "ommand' )o%ever in an in era" ive s"ri* , e"ho *asses he message o he user hrough ermina#' 6 is one o! he "ommand ha is "ommon#y used in s"ri* ing, in era" ive s"ri* ing'
root@tecmint:~# echo :3ecmint.com is a "ery 'ood we!site: 3ecmint.com is a "ery 'ood we!site crea in# a small in erac ive scri%

1' "rea e a !i#e, named 0in erac ive;s"ell.s"0 on desk o*' 13emem&er 0.s"0 ex ension is mus 2' 2' "o*y and *as e he &e#o% s"ri* , exa" #y same, as &e#o%'
#U/!in/!ash

Page1

echo :2lease enter your name:: read name echo :Kelcome to Ginux Vname:

$ex , se exe"u e *ermission and run he s"ri* '


root@tecmint:~# chmod /// interacti"e,shell.sh root@tecmint:~# ./interacti"e,shell.sh 2lease enter your name: Fa"i (ai"e Kelcome to Ginux Fa"i (ai"e

No e: 0<=&2in&2as"0 e##s he she## ha i is an s"ri* an i is a#%ays a good idea o in"#ude i a he o* o! s"ri* ' 0read0 reads he given in*u '

**. Command: %ass'd


(his is an im*or an "ommand ha is use!u# !or "hanging o%n *ass%ord in ermina#' O&vious#y you need o kno% your "urren *asso%rd !or -e"uri y reason'
root@tecmint:~# passwd 6han'in' password for tecmint. *current+ R98H password: ******** 5nter new R98H password: ******** Fetype new R98H password: ******** 2assword unchan'ed D)ere was passowrd remians unchan'ed4 i.e.4 new password;old passwordE 5nter new R98H password: ##### Fetype new R98H password:#####

*+. Command: l%r


(his "ommand *rin !i#es named on "ommand #ine, o named *rin er'
root@tecmint:~# lpr -2 desk@et-M.01-series --final.pdf

No e: (he 0l%>0 "ommand #e s you vie% he s a us o! a *rin er 1%he her i :s u* or no 2, and he >o&s 1!i#es2 %ai ing o &e *rin ed'

*/. Command: cm%


"om*are %o !i#es o! any y*e and %ri es he resu# s o he s andard ou *u ' By de!au# , 0cm%0 3e urns 0 i! he !i#es are he same@ i! hey di!!er, he &y e and #ine num&er a %hi"h he !irs di!!eren"e o""urred is re*or ed' (o *rovide exam*#es !or his "ommand, #e s "onsider %o !i#es:
file1. x root@tecmint:~# cat file-.txt )i 7y name is 3ecmint file2. x

Page1

root@tecmint:~# cat file0.txt )i 7y name is tecmint DdotE com

$o%, #e :s "om*are %o !i#es and see ou *u o! he "ommand'


root@tecmint:~# cmp file-.txt file0.txt file-.txt file0.txt differ: !yte -$4 line -

*4. Command: '#e


:#e is a !ree u i#i y !or non.in era" ive 1i'e', "an %ork in &a"kground2 do%n#oad o! !i#es !rom he Ae&' 6 su**or s ?@@,, ?@@,7, F@, *ro o"o#s and ?@@, *roxies' .o'nload ffm%e# usin# '#e
root@tecmint:~# w'et http://downloads.sourcefor'e.net/pro@ect/ffmpe'-php/ffmpe'php/1...1/ffmpe'-php-1...1.t! 0 --01-#-1$-00 -%:$M:$0-- http://downloads.sourcefor'e.net/pro@ect/ffmpe'php/ffmpe'-php/1...1/ffmpe'-php-1...1.t! 0 Fesol"in' downloads.sourcefor'e.net *downloads.sourcefor'e.net+... 0-..#M.-%-.$N 6onnectin' to downloads.sourcefor'e.net *downloads.sourcefor'e.net+? 0-..#M.-%-.$N?:%1... connected. )332 re&uest sent4 awaitin' response... #10 Qound Gocation: http://ka .dl.sourcefor'e.net/pro@ect/ffmpe'-php/ffmpe'php/1...1/ffmpe'-php-1...1.t! 0 Dfollowin'E --01-#-1$-00 -%:$M:$M-- http://ka .dl.sourcefor'e.net/pro@ect/ffmpe'php/ffmpe'-php/1...1/ffmpe'-php-1...1.t! 0 Fesol"in' ka .dl.sourcefor'e.net *ka .dl.sourcefor'e.net+... N0.M..$#.-.# 6onnectin' to ka .dl.sourcefor'e.net *ka .dl.sourcefor'e.net+? N0.M..$#.-.#?:%1... connected. )332 re&uest sent4 awaitin' response... 011 CJ Gen'th: 0/$$$/ *0.NJ+ Dapplication/octet-streamE (a"in' to: Wffmpe'-php-1...1.t! 0X -11S D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YE 04/$4$$/ ./.%JB/s in M.1s 01-#-1$-00 -%:$$:11 *./.% JB/s+ - Wffmpe'-php-1...1.t! 0X sa"ed D0/$$$//0/$$$/E

*(. Command: moun


Moun is an im*or an "ommand %hi"h is used o moun a !i#esys em ha don: moun i se#!' You need roo *ermission o moun a devi"e' 5irs run 0ls2l00 a! er *#ugging.in your !i#esys em and iden i!y your devi"e and no e do%n you devi"e assigned name'
root@tecmint:~# ls!lk 9<75 7<Z:789 F7 (8I5 FC 3B25 7CR932C893 sda %:1 1 N#-.$[ 1 disk \]sda%:1 N0#..[ 1 part / \]sda0 %:0 1 -J 1 part ^]sda$ %:$ 1 /.N[ 1 part D(K<2E sr1 --:1 - -10M7 1 rom

Page1

sd! ^]sd!-

%:-. %:-/

#./[ #./[

1 disk 1 part

5rom his s"reen i %as "#ear ha 6 *#ugged in a + A5 *endrive hus 0sd210 is my !i#esys em o &e moun ed' Be"ome a roo o *er!orm his o*era ion and "hange o &dev dire" ory %here a## he !i#e sys em is moun ed'
root@tecmint:~# su 2assword: root@tecmint:~# cd /de"

Crea e a dire" ory named any hing &u shou#d &e re#even !or re!eren"e'
root@tecmint:~# mkdir us!

$o% moun !i#esys em 0sd210 o dire" ory 0us20'


root@tecmint:~# mount /de"/sd!- /de"/us!

$o% you "an naviga e o &dev&us2 !rom ermina# or B-'indo's sys em and a"ess !i#e !rom he moun ed dire" ory'

@ime for Code .evelo%er o 0no' "o' ric" Linux environmen is


*1. Command: #cc
#cc is he in.&ui# "om*i#er !or 0c0 #anguage in Linux ,nvironmen ' A sim*#e c *rogram, save i on ur desk o* as ?ello.c 1remem&er 0.c0 ex ension is mus 2'
#include _stdio.hY int main*+ ` printf*:)ello worldan:+> return 1> b Com%ile i root@tecmint:~# 'cc )ello.c 8un i root@tecmint:~# ./a.out )ello world

No e: On "om*i#ing a c *rogram he ou *u is au oma i"a##y genera ed o a ne% !i#e 7a.ou = and every ime you "om*i#e a c *rogram same !i#e 7a.ou = ge s modi!ied' )en"e i is a good advi"e o de!ine a ou *u !i#e during "om*i#e and hus here is no risk o! over%ri e o ou *u !i#e'
Com%ile i "is 'a6 root@tecmint:~# 'cc -o )ello )ello.c

Page1

)ere 0-o0 sends he ou *u o 0?ello0 !i#e and no 0a.ou 0' 3un i again'
root@tecmint:~# ./)ello )ello world

*9. Command: #++


#++ is he in.&ui# "om*i#er !or 0C++0 , he !irs o&>e" orien ed *rogramming #anguage' A sim*#e c++ *rogram, save i on ur desk o* as Add.c%% 1remem&er 0.c%%0 ex ension is mus 2'
include _iostreamY usin' namespace std> int main*+ ` int a> int !> cout__:5nter first num!er:an:> cin YY a> cout __:5nter the second num!er:an:> cinYY !> cin.i'nore*+> int result ; a = !> cout__:Fesult is:__: :__result__endl> cin.'et*+> return 1>

b Com%ile i

root@tecmint:~# '== <dd.cpp 8un i root@tecmint:~# ./a.out 5nter first num!er: ... ...

No e: On "om*i#ing a c++ *rogram he ou *u is au oma i"a##y genera ed o a ne% !i#e 7a.ou = and every ime you "om*i#e a c++ *rogram same !i#e 7a.ou = ge s modi!ied' )en"e i is a good advi"e o de!ine a ou *u !i#e during "om*i#e and hus here is no risk o! over%ri e o ou *u !i#e'
Com%ile i "is 'a6 root@tecmint:~# '== -o <dd <dd.cpp 8un i root@tecmint:~# ./<dd 5nter first num!er: ... ...

Page1

+0. Command: java


Cava is one o! he %or#d:s high#y used *rogramming #anguage and is "onsidered !as , se"ure, and re#ia&#e' Mos o! he he %e& &ased servi"e o! oday runs on >ava' Crea e a sim*#e >ava *rogram &y *as ing he &e#o% es o a !i#e, named ecmin .java 1remem&er 0.java0 ex ension is mus 2'
class tecmint ` pu!lic static "oid main*(trin'DE ar'uments+ ` (ystem.out.println*:3ecmint :+> b b com%ile i usin# javac root@tecmint:~# @a"ac tecmint.@a"a 8un i root@tecmint:~# @a"a tecmint

No e: A#mos every dis ri&u ion "omes *a"ked %i h #cc com%iler, ma>or num&er o! dis ros have in&ui# #++ and java com%iler, %hi#e some may no have' You "an a% or 6um he re;uired *a"kage' ?on: !orge o men ion your va#uea&#e "ommen and he y*e o! ar i"#e you %an o see here' 6 %i## soon &e &a"k %i h an in eres ing o*i" a&ou he #esser kno%n !a" s a&ou Linux'

Page1

You might also like