You are on page 1of 5

Basi c Commands

1. l s - l f or l i st i ng t he f i l es as wel l as di r ect or i es t hose ar e kept i n


t he par t i cul ar wor ki ng di r ect or y
synt ax
[ r oot @net t ech r oot ] #l s - l

2. l s - l a same as ' l s - l ' but by t hi s command we can al so see t he hi den
f i l es.
synt ax
[ r oot @net t ech r oot ] #l s - l a
3. l s - l i same as ' l s - l a' but i t wi l l al so shows us t he i node number of
each and ever y f i l e
synt ax
[ r oot @net t ech r oot ] #l s - l i
4. l s by t hi s command we can see onl y f i l e name not hi ng el se
synt ax
[ r oot @net t ech r oot ] #l s
5. cl ear i t wi l l cl ear t he scr een( shor t cut ct l +l )
synt ax
[ r oot @net t ech r oot ] #cl ear
6. exi t t o end a cur r ent sessi on as wel l cur r ent t er mi nal l oggi ng
synt ax
[ r oot @net t ech r oot ] exi t
7. t ouch t o cr eat e a new empt y f i l e
synt ax
[ r oot @net t ech r oot ] #t ouch
8. cd t o change t he wor ki ng/ pr esent di r ect or y
synt ax
[ r oot @net t ech r oot ] #cd / home/ mango
wher e ' / home/ mango' i s t he desi r ed di r ect or y t o be change f r om
' / r oot '
9. cat t o vi ew t he cont ent s of a f i l e and i t i s al so used f or cr eat i ng a
new f i l e wi t h some cont ent s
synt ax
[ r oot @net t ech r oot ] #cat <f i l e name> t o vi ew f i l e cont ent s
[ r oot @net t ech r oot ] #cat > newf i l ename ent er , t hen you can wr i t e somet hi ng i n
t he f i l e and t hen t o save t he f i l e cont ent s pr ess cl t +d t hen ent er
10. mkdi r t o make a new di r ect or y
synt ax
[ r oot @net t ech r oot ] #mkdi r newdi r name
you can al so cr eat e a di r ect or y at your desi r ed pat h wi t hout
changi ng your pr esent wor ki ng di r ect or y
synt ax
[ r oot @net t ech r oot ] #mkdi r / home/ mango/ newdi r name
11. r m t o r emove a empt y f i l e
synt ax
[ r oot @net t ech r oot ] #r mf i l ename
Page 1
Basi c Commands
12. r mdi r t o r emove a empt y di r ect or y
synt ax
[ r oot @net t ech r oot ] #r mdi r di r ect or yname
13. r m[ - i / - r / - f ] t o r emove a di r ect or y wi t h i t s subdi r ect or i es as wel l as i t s
f i l es t hat i s t o r emove a di r ect or y whi ch al r eady cont ai ns some f i l es i n i t
synt ax
[ r oot @net t ech r oot ] #r m- i di r ect or y/ f i l ename
- i st ands f or i nt er act i vel y
- r st ands f or r ecur si vel y
- f st ands f or f or cef ul l y
14. cp t o copy somet hi ng i n a dest i nat i on f i l e or di r ect or y
synt ax
[ r oot @net t ech r oot ] #cp sour cepat h dest i nat i onpat h
exampl e: [ r oot @net t ech r oot ] #cp / home/ mango/ webmi n. r pm/ r oot / abcd
i n t hi s exampl e t he webmi n. r pmf i l e wi l l be copi ed i n
/ r oot / abcd di r ect or y
15. mv t o move one f i l e or di r ect or y f r omone pl ace t o anot her pl ace, i t
i s al so used f or r enami ng adi r ect or y or f i l e
synt ax
[ r oot @net t ech r oot ] #mv sour ce dest i nat i on
[ r oot @net t ech r oot ] #mv ol df i l ename newf i l ename [ t o change t he f i l e name]
16. man t o vi ew t he mannual page of commands f or synt ax
synt ax
[ r oot @net t ech r oot ] #man commandname
17. i nf o t o vi ew t he i nf or mat i on about any command
synt ax
[ r oot @net t ech r oot ] #mkdi r i nf o
18. - - hel p t o vi ew t he hel p doccument s of a command
synt ax
[ r oot @net t ech r oot ] #commandname - - hel p
19. di r t o vi ew t he subdi r ect or i es and f i l esn under t he di r ect or y
synt ax
[ r oot @net t ech r oot ] #di r
20. su - t o become a super user
synt ax
[ mango@net t ech mango] $su -
out put wi l be
[ r oot @net t ech r oot #]
21. who by t hi s command you can see t he user name and t hei r i p addr esses
who have l oged i n on your ser ver
synt ax
[ r oot @net t ech r oot ] #who
22. whoami t hi s command shows your cur r ent l ogged i n t er mi nal user name
synt ax
[ r oot @net t ech r oot ] #whoami
23. who ami t hi s command shows you t he l ogged i n t er mi nal number and user
name and mor e det ai l ed i nf or mat i on
Page 2
Basi c Commands
synt ax
[ r oot @net t ech r oot ] #who ami
24. pwd t o vi ew t he pr esent wor ki ng di r ect or y
synt ax
[ r oot @net t ech r oot ] #pwd
25. r pm- i vh t o i nt al l a r pmpackage
synt ax
[ r oot @net t ech r oot ] #r pm- i vh packagename. r pm
r pmst ands f or ' r edhat package manager '
- i st ands f or i nst al l
- v st ands f or ver bose mode
- h st ands f or wi t h hash si gn( #)
26. r pm- q t o quer r y about any r pmpackage
synt ax
[ r oot @net t ech r oot ] #r pm- q packagename
27. r pm- e t o uni nst al l a r pmpackage
synat x
[ r oot @net t ech r oot ] #r pm- e package
28. f i nd / - name t o f i nd any f i l e or di r ect or y i n l i nux f i l e syst em
synt ax
[ r oot @net t ech r oot ] #f i nd / - name f i l ename
29. su user name t o swi t ch f r omone user t o anot her user s home di r ect or y
synt ax
[ r oot @net t ech r oot ] #su mango
out put wi l l be
[ mango@net t ech r oot ] #cd
[ mango@net t ech mango] #


30. su - user name t o swi t ch f r omone user t o anot her user user s home
di r ect or y di r ect l y
synt ax
[ r oot @net t ech r oot ] #su - mango
31. user add t o cr eat e a new user
synat x
[ r oot @net t ech r oot ] #user add user name
32. passwd t o gi ve a passwor d of a user
synt ax
[ r oot @net t ech r oot ] #passwd t ar un
out put wi l l be
gi ve a passwor d f or user t ar un: ( her e you have t o t ype a passwor d f or t ar un user )
conf i r mpasswor d: ( agai n t ype t he same passwor d)
33. user del t o r emove a user f r oml i nux
synt ax
[ r oot @net t ech r oot ] #user del t ar un
Page 3
Basi c Commands
34. gr oupadd t o add a new gr oup
synt ax
[ r oot @net t ech r oot ] #gr oupadd gr oupname
35. gr uopdel t o del et e a gr oup
synt ax
[ r oot @net t ech r oot ] #gr oupdel gr oupname
36. chown t o change t he owner shi p of a f i l e or di r ect or y
synt ax
[ r oot @net t ech r oot ] #chown owner name f i l ename
exampl e:
[ r oot @net t ech / ] #l s - l
out put
dr wxr w- r w- 2 r oot r oot 4096 Mar 11 12: 03 abcd
( per mi ssi on) ( own) ( gr oup own) ( si ze) ( name)
[ r oot @net t ech r oot ] #chown t ar un / abcd
i n t hi s exampl e / abcd di r ect or y owner wi l l be change t o t ar un user
ef f ect
[ r oot @net t ech / ] #l s - l
dr wxr w- r w- 2 t ar un r oot 4096 Mar 11 12: 03 abcd
37. chgr p t o change t he gr oup owner shi p of a f i l e or di r ect or y
synt ax
[ r oot @net t ec r oot ] #chgr p newgr oupowner name f i l ename
exampl e
[ r oot @net t ech / ] #l s - l
dr wxr w- r w- 2 t ar un r oot 4096 Mar 11 12: 03 abcd
[ r oot @net t ech r oot ] #chgr p t ar un / abcd
ef f ect
[ r oot @net t ech / ] #l s - l
dr wxr w- r w- 2 t ar un t ar un 4096 Mar 11 12: 03 abcd
38. chmod t o change t he per mi ssi on of a f i l e or di r ect or y
dr wxr w- r w- 2 r oot r oot 4096 Mar 11 12: 03 abcd
( per mi ssi on) ( ownr ) ( gr pownr ) ( si ze) ( name) I N
OCTAL VALUE
d st ands f or di r ect i r y READ=4
r st ands f or r ead onl y per mi ssi on WRI TE=2
w st ands f or wr i t e onl y per mi ssi on EXECUTE=1
x st ands f or execut e onl y per mi ssi on
dr wxr w- r w- FI RST OCTET FOR DENOTI NG THE DI RECTORY OR FI LE OR LI NK FI LE ETC.
SECOND THREE OCTET FOR USER OR OWNER PERMI SSI ON ( r wx OR 7 I N
OCTAL VALUE)
THI RD THREE OCTET FOR GROUP PERMI SSI ON ( r w- OR 6 I N OCTAL VALUE)

FORTH THREE OCTET FOR OTHERS PERMI SSI ON ( r w- OR 6 I N OCTAL VALUE)
SYNTAX
[ r oot @net t ec r oot ] #chmod val ue f i l eor di r ect or yname
exampl e
[ r oot @net t ech / ] #l s - l
dr wxr w- r w- 2 t ar un r oot 4096 Mar 11 12: 03 abcd
[ r oot @net t ech / ] #chmod 402 / abcd
[ r oot @net t ech / ] #l s - l
dr w- - - - - w- 2 t ar un t ar un 4096 Mar 11 12: 03 abcd
40. user mod t o modi f y t he user pr of i l e
Page 4
Basi c Commands
synat x
[ r oot @net t ech r oot ] #user mod - par amet er gr oupname user name
Page 5

You might also like