0% found this document useful (0 votes)
23 views

Linux Commands

The document provides information on various Linux commands and their usage. It covers commands for navigating and viewing directories and files, manipulating files, viewing system information, managing users and groups, searching for files, piping commands together, and more. Examples are given for most commands.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Linux Commands

The document provides information on various Linux commands and their usage. It covers commands for navigating and viewing directories and files, manipulating files, viewing system information, managing users and groups, searching for files, piping commands together, and more. Examples are given for most commands.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

v i

deo- 1
1)pwd: printwor kingdi rect ory
2)l
s: tol i
stf ilesi npwd
3)Cmd: commandpr ompt
4)Mkdi r( fi
lename) :t
ocr eat eadi rect or y
5)touch: usedt ocr eat eaf ilewi thoutanycont ent
6)Echo: displ ayl ineoft extt hatar epassedasanar gument
7)Clear: remov eal lprev iouscommands
8)Dat e,
Ti me: Usedt odi spl aydat eandt i
me
10)cd: Changedi rector y( Goest ohomedi rect orybydef aul
t)
11)cal :Displ ay st hecal endar
12)host name: whati st hemachi ne'sname
13)host name- i:display st hei paddr essoft hemachi ne
14)host : displ ay st hesetofar gument s
15)uname: showst heki ndofOS
16)uname- m: displ ayst hear chi tect ur eoft heOS
17)uname- a: displ aysev er ydet ailsliket ypeofOS, wher eitishost
ed
18)man( command) :displ ay sal l t
hecommandr el
atedt oit
19)sudo- i
: t
akest or ootuser
20)ll
: l
ongl ist
21)touch( f i
lename) :tocr eat eaf ile
22)vim( fil
ename) :toi nser toredi tdet ails
23)cat( filename) :todi spl ayt hecont ent soft hef il
e
24)rm( fi
lename) :remov et hef i
le
25)ls- l
art :tov i
ewal lthef ilesal ongsi det hehi ddenf il
es
26)mv :tor enamet hef ileandal sot or enamet hedirectoryinwhichiti
spresent
27)cp: tocopyaf ile
28)rmdi r: remov et hedi rect or y
29)cat/ et c/ os-r elease: toout putt hecont entofOSr elease
30)!l
l:thel astr uncommandi nl lget sr epeat ed
31)histor y: l
istsal lthecommandsusedf rom t hebegi nning
32)mv( file. fi
le) :tohi det hef ile
33)diff:showst hedi ffer encebet ween2f i
les
34)cp- R: Recur sivecopy (copyal lthesour ce, dir,f
il
est oanewl ocati
on)
35)apti nst all tree: toi nst al lat ool (tree=t ool )
36)aptupdat e: toupdat et ool t ot hel at estv er sion
37)tree- aGFG: showst hedi rect oriesi nasi mpl ermanner (
GFG-Dir
ector
y)
38)id: i
dent i
tyoft heper son( idubunt u)
39)who: showswhocur r ent lyl oggedi ntot hemachi ne
40)sudochownr oot( filename) :usedt ochanget heowner shiporthedi
rector
y
41)sudochown:wezv a( filename) :t hegr oup wi l
lbechangedandt heusernamer
emai
nst
he
same
42)sudochownr oot :
wezv a( fi
lename) : t
ochanget heuser name
43)user add( user name) : tocr eat eauser name
44)addgr oup(gr oupname) : t
ocr eat eagr oup
45)user del :todel et eauser name
46)groupdel /del group: todel et eagr oup

video-2
1)touch1\2\3: (
\:t
omakei tt
oasi nglefil
e)
2)head( f
ilename) :
topr intthefi
rsttenlinesofthecontenti
nt hef
il
e
3)head-n( numberofl inestobepr i
nted)(fi
lename):t
opr i
ntthespeci
ficlinesi
ntop
4)tai
l(fi
lename) :pri
ntst helastt
enl i
nesbydef ault
5)tai
l-n(numberofl inest obepr i
nted)(fil
ename):toprintt
hespecifi
clinesatthebot
tom
6)rm- r
f:forci
bleandr ecursivedelete
7)wc- l(
fil
ename) :showst henumberofl i
nesinthefi
le
8)mor e(filename) :Showst hefullcont enti nt hef i
lewher e" cat"hassomer est
ri
cti
ons
9)less(fi
lename) :
showst hef ullcontentf rom t hebot tom
10)head- n( numberofl i
nest obepr int ed)( fil
ename) |
tail-n(numberofl i
nestobeprint
ed)( f
il
e
name) :printst hel i
nesi nbet weent hem
(|
-pipecommand: i
tisusedwhenout putofonecommandi stobef ededasinputtothenext
command)
11)wc( fil
ename) :displaysnoofl ines,wor ds,charact ersint hefil
e
12)wc- c( fil
ename) :display sthechar act ersal one
*13)source: t osett hehomepat h
14)ls>( fi
lename) :topr intthedat aint hescr een
15)which( util
ity):t
oshowt hepat hoft heut ili
ty
16)wher eis( fi
leorut il
ity):
showst henamer elatedtot heut ili
ty,
fi
le
17)getentpasswd: whoar eal lusingt hecur rentpar ticularmachi ne
18)echohel lo|cut-c1: printst hefirstchar acteri nthewor d"Hel l
o"
19)echo" hellost udent s-hi"|cut-f
1: printst hecompl etestring
20)echo" helloev eryone" |t
r""" ~": pri
ntshel lo~ev eryone( Remov estheempt yspaceandadd' ~'
)
21)echo" hello ev eryone" |
tr-s"" :shr inkal lt
heempt yspacesandr emovedoublequotes
22)find./(direct ory)-empt y :toseewhet hert hef il
eisempt y
(dot(.)represent scur r
entdi r
ect ory)
23)find./(direct ory)-name( f i
l
ename) : findst hespeci fi
edf il
eint hedi
rectory

video- 3
1)cat(fil
ename) |sort:sor tst hecont ent sint hef il
e
2)sort(filename)>( newf ilename) : sor tt hecont enti ntheol df i
leandr edirectittonewf il
e
(>:redi r ectoper at or )
3)sort(filename) :display st hesor tedl i
st
4)sort-o( targetf i
le)(sour cef i
le):sor tt hecont enti nthesour cefi
leandpl acesi tint argetfi
le
wi thoutr edirecti
onal operator
5)sort-r( fi
lename) :sor tsi nr ev erseor der
6)sort-n( fil
ename) : numer icsor t
7)sort-u( fil
ename) : tor emov et hedupl icat es
8)sort-k4( f
ilename) :sor tt he4t hcol umnoft hef i
le
9)sort-R( fil
ename) :Random sor t
10)sed- -versi on: pri
nt sthedet ail
soft heut ili
ty(sed)
11)sed' s/uni x/ l
inux /'( fi
lename) :useaut il
itysedi nt hef i
leanddoast ri
ngr eplacementby
repl
acingt hewor duni xbyl inuxi nthef irstoccur anceofeachl i
ne
12)sed' s/uni x/ l
inux/ g' (fil
ename) : repl acet hewor duni xbyl i
nuxgl oball
y
13)sed' s/uni x/ l
inux/ gi'( fil
ename) :r epl acet hewor duni xbyl i
nuxgl oballyirrespect i
veoft he
caseinsensi tiv e
14)sed' 2,5s/ uni x/li
nux/ g' ( fi
lename) :repl acet hewor dsbet weenl i
ne2t o5
15)sed- n' 5,
10p' (fil
ename) : printlines5t o10
16)sed' 5d' (fi
lename) :del et e5t hline
17)sed- n- e'5, 7p' -
e'10, 13p' (filename) :displ ay slinesf rom 5t o7and10t o13
18)sed' /abc/ d' (f il
ename) : del etepat ter nmat chingl i
ne
19)sed- i
.bak- e' s/org/ repl /g'( fi
lename) :iwi lluset hesamef i
lenameandwi lltakeabackup
withaf i
lename. bak
20)grep: global regul arexpr essi on
1.
^-mat cht hebegi nningoft hel ine
2.
$-mat cht heendoft hel ine
21)grep( wor d)( filename) : displ ayst hel i
newhi chhast hewor dandhighlightsit
22)grep- n( wor d)( f
il
ename) :di splay st hel inewhi chhast hewor dandhi ghlightsital ongwiththe
l
inenumber
23)grep- v( wor d)( fi
lename) : display sexceptt helinewhi chhast hepar ti
cularwor d
24)grep" ^$"( filename) : displ ay st heempt ylinei fitexistsi nthefil
e
25)grep- n- A2( wor d)( filename) :di spl ayst hepar ti
cularwor dandt henext2l i
nesi rrespecti
veof
thewor d
26)egr
ep"unix|Uni
x|
linux(f
il
ename):displ
aysthegi
venwor
ds
|
_extendedgr ep-usedformult
iplewords
27)fgr
ep(wor d)(f
il
ename) :di
spl
aysthelinewit
hthewordi
rr
espect
iveoft
hemet
achar
act
er
foundi
nthewor d

video- 4
1)l
s-l |awk' { pri
nt$1} '
:pr i
nt st hef i
rstcol umn
(awki susedt opr intcol umnardat a)
2)awk' {print }'
(fi
lename) : printal l t
hecont ent
si nt hef i
le
3)awk' {print$3} '(f
ilename) :pr intst he3r dcolumni nt hef i
le
4)awk' / (
wor d)/{print}
'(f i
lename) :printst helinet hathast hepar ti
cularword
5)awk' {printNR, $0} '(
fil
ename) : printsal lthelinewi tht helinenumber
6)awk' {print$1, $NF} '
(filename) :pr i
ntst hef i
rstandl astcol umn
(NF-di spl aysthel astf ield)
7)awk" NR==3, NR==6{ printNR, $0} '(fil
ename) :displaysl i
nesf r
om 3t o6
8)awk' NF>0' (
filename) :print st hel astf i
eldwhi chhasv aluegr eat
ert han0
9)ps:di splay sall processt hatar erunni ngi nthepar ticularmachi ne
10)ps- e: display st helinet hatr unsbehi ndwi thoutourknowl edge
11)ps- ely:di splay sallthecol umnsi nthepr ocessst at e
12)ps- axjf: topr intapr ocesst ree
13)Toseeev erypr ocesswi thauserdef inedfor mat
i)ps- eopi d,tid,
class, rtprio,ni,pri,
psr ,
pcpu,stat ,
wchan: 14, comm
i
i)psaxost at,euid,ruid,tty,tpgid,sess, pgrp,ppid,pid,pcpu,comm
i
i
i)ps- Aopi d,tt,
user ,f
name, tmout ,
f,wchan
14)ps- Csy slogd- opid=: printsonl yt hepr ocessI Dsofsy slogd
15)ps- q( number )-ocomm=: pr intsonl yt henameofPI Doft hegivennumber
16)uid: tell
swhet hertheper sonl oggedi ni sar ootuseroranor mal user
17)ki
ll -9PI D: toki l
l apr ocess
18)sour ce( filename) : tor unacommand
19)ki
ll -1:toseet hel i
stofav ailablesi gnal s

vi
deo-5
1)top:cpuut i
li
zat ion
2)uptime:loadav erageandsy stem uptime
3)netstat:printsnet wor kconnecti
ons
4)netstat-tulpn|gr epLISTEN: di
spl
ay sonlytheli
steni
ngpor t
s
5)free:di
spl ayst hef reememor yavailableint
hemachi nedefaul
tl
yinKBs
6)free-m: display st hefreememor yav ai
labl
einthemachi neinMBs
7)free-g:display st hefreememor yav ail
ablei
nthemachi neinGBs
8)du: i
twillshowt hememor yinbyt
es

v
ideo-6
1)xargs-iti
susedt obui
ldandexecutecommandsf rom st
andar
dinput
2)l
sof :
retri
eveinf
ormationaboutfi
l
est hatar
eopenedbyvari
ousprocesses
3)l
scpu- a,-
p:i
tgathersCPUarchit
ectureinf
ormat
ion
4)sar-u13: displ
aysCPUusagef or1seconddiff
erence3ti
mes
5)sar-r:memor yusage
7)scp:securecopy

video-7
1)crontab-e:toedi tintheli
stofcr
onjobs
2)crontab-l
: t
olistt hecronj
obs
3)nohup:execut esacommandandi nstr
uctst
hesy stem t
ocont i
nuerunni
ngit
,ev
enwhent
he
sessionisdisconnect ed
4)nohupbash( f
ilename)>( newfi
lename) :r
edi
rect
st hecontenti
ntheoldfi
l
etoanewfi
l
e
5)tee:readsthest andardi/pandwr i
tesittobot
hstandardo/pandoneormor efi
l
es
6)l
s| t
ee( fi
lename) :
theoutputofl scommandshoul dbef edasani /
ptothenewf i
le
(teecommandwi llshow theout putonthescreenandt osendi
tto
newf il
e)
7)env :printall expor t
edenv i
ronmenti namodi fi
edenv i
ronment
8)printenv :printal lorpartofenv i
ronment
9)set: pri
ntt henameandv alueofeachShel lvar
iabl
e
10)DNS: Domai nNami ngServ i
ce-i
tmapsev er
yipaddr esswi thaname
11)host name- I
: providestheI Paddresstot hemachinel oggedi n
12)what is: sear chest hedatabaseofmanpagesandl i
stst hebr i
efdescr
ipt
ionofeachmanual
13)alias:shor tnamesf orcompl excommands
14)strace: anythingy ouwantt oseewhent heprogram isr unning
15)chsh: tochanget heshell
16)Inodes: anyt ypeoff i
lewecr eatewill
best oredasani nodet othemaachine
17)df- i:
di splay st heinodesthatar eavai
lableont hesystem
18)wget ,cur l
:theset wocommandsar eusedt odownl oadanybi nari
esfr
om theint
ernet

You might also like