Unix Commands
Unix Commands
xIntroducti
on
TheUni xoperati
ngsys
tem i
sas
etofprogramsthatactasal
inkbetweenthe
computerandtheuser.
Thecomputerprogramsthatal
locatethes
ystem res
ourcesandcoordinateal
l
thedetai
lsofthecomputer'si
nternal
siscall
edtheoperatingsystem orthe
kernel
.
Unixwasoriginall
ydevelopedi
n1969byagroupofAT&Templ oyeesKen
Thompson,DennisRitchi
e,Dougl
asMcI
lroy,andJoeOs
sannaatBellLabs
.
TherearevariousUnixvari
antsavai
lablei
nthemarket.Solari
sUnix,
AIX,HPUni xandBSDareafewexampl es
.Linuxi
sal
soafl avorofUnix
whichisfreel
yavail
able.
Severalpeopl
ecanuseaUnixcomputeratthes
ameti
me;henceUni
xis
call
edamul tius
ers
ystem.
Ausercanal
sor unmul
tipl
eprogramsatthes
ameti
me;hence
Uni
xisamultitaski
ngenvi
ronment.
Uni
xArchi
tecture
Herei
sabas
icbl
ockdi
agramofaUni
xsys
tem–
Themainconceptthatuni
tesal
lthevers
ionsofUni
xisthefol
lowi
ngfour
bas
ics−
Kernel:Thekernelistheheartoftheoperati
ngs ys
tem.Itinteracts
withthehardwareandmos tofthetas
ksl
ikememorymanagement,task
scheduli
ngandfilemanagement.
Shell
:Thes hel
listheutili
tythatproces s
esyourreques ts
.Whenyoutype
in a command atyourtermi nal
,thes hellinterpretsthecommand and
call
stheprogram thatyouwant.Thes hellusesstandardsyntaxforall
commands.CShel l
,BourneShellandKornShel larethemos tfamousshel
ls
whichareavailabl
ewi thmostoftheUni xvari ants
.
CommandsandUti li
ties:Therearevari ouscommandsanduti l
iti
eswhi
ch
youcanmakeus eofi nyourdaytodayacti viti
es.cp,mv,catandgrep,
etc.arefew examplesofcommandsand uti l
iti
es.Thereareover250
standardcommandsplusnumerous
dedthrough3rd partys
o othersprovi oftware.Al
lthecommandscome
alongwithvariousopti
ons.
FilesandDirectori
es:AllthedataofUni xi sorganizedi ntofi
les
.All
fil
esarethenorgani z
edi ntodirectori
es.Thes
edi rectori
esarefurther
organiz
edintoatree-likestructurecall
edthefil
es ys
tem.
Sys
temBootup
Ifyouhaveacomputerwhi
chhastheUnixoperati
ngsys
temins
tal
ledi
nit,
thenyousimpl
yneedtoturnonthesys
temtomakei tli
ve.
Assoonasyouturnonthes ystem,i
tstartsbooti
ngupandfinall
yi tprompts
youtologintothes ystem,whichisanactivi
tytol ogi
ntothesystem anduse
itforyourday-to-dayactivi
ties.
Logi
nUni
x
Whenyoufirs
tconnecttoaUni
xsys
tem,youus
ual
lys
eeaprompts
uchasthe
fol
lowi
ng:
Tol
ogi
n
Haveyouruserid(useri
denti
ficati
on)andpass
wordready.Contactyour
sys
temadministratorifyoudon'
thavetheseyet.
Typeyourus eri
datthel oginprompt,thenpres
sENTER.Youruseri
dis
case-s
ens i
tive, so be s ure you type it exactl
y as your sys
tem
administratorhasinstructed.
Typeyourpas
swordatthepass
wordpr
ompt,thenpres
sENTER.Your
pass
wordisal
socase-s
ens
iti
ve.
Ifyouprovidethecorrectus eri
dandpas sword,thenyouwillbeal
lowed
toenterintothes ystem.Readtheinformationandmes s
agesthatcomes
uponthes creen,whi
chi sasfoll
ows
.
Li
nux:
l
ogi
n:mca
pas
sword:
avmca
Uni
x:
Logi
n :
mca
Pas
sword :
avmca
Uni
x/Li
nuxCommands
Pwd:
Pres
entWorki
ngDi
rectory
[
mca@avmca~
]$pwd
/
home/
mca
[
mca@avmca~
]$tty
/
dev/
pts
/0
[
mca@avmca~
]$whoami
mca pts
/0 2019-02-1111:
42(
200.
200.
30.
119)
[
mca@avmca~
]$who
mca pts
/0 2019-02-1111:
42(
200.
200.
30.
119)
mca pts
/1 2019-02-1111:
45(
200.
200.
30.
120)
mca pts
/2 2019-02-1111:
54(
200.
200.
30.
114)
mca pts
/3 2019-02-1111:
59(
200.
200.
30.
115)
mca pts
/4 2019-02-1111:
59(
200.
200.
30.
111)
mca pts
/5 2019-02-1112:
17(
200.
200.
30.
107)
mca pts
/6 2019-02-1112:
02(
200.
200.
30.
108)
mca pts
/7 2019-02-1112:
04(
200.
200.
30.
110)
[
mca@avmca~
]$whoami
mca pts
/0 2019-02-1111:
42(
200.
200.
30.
119)
[
mca@avmca~
]$who-uH
NAME LI
NE TI
ME I
DLE PI
DCOMMENT
mca pts/
0 2019-02-1111:
42 . 2460
(
200.200.30.119)
mca pts
/1 2019-02-1111:
4500:
14 2515 (
200.
200.
30.
120)
mca pts
/2 2019-02-1111:
54 . 2594(
200.
200.
30.
114)
mca pts
/3 2019-02-1111:
59 . 2650(
200.
200.
30.
115)
mca pts
/4 2019-02-1111:
59 . 2661(
200.
200.
30.
111)
mca pts
/5 2019-02-1112:
17 . 3066(
200.
200.
30.
107)
mca pts
/6 2019-02-1112:
02 . 2760(
200.
200.
30.
108)
mca pts
/7 2019-02-1112:
04 . 2847(
200.
200.
30.
110)
[
mca@avmca~
]$who-u
mca pts
/0 2019-02-1111:
42 . 2460(
200.
200.
30.
119)
mca pts
/1 2019-02-1111:
4500:
14 2515(
200.
200.
30.
120)
mca pts
/2 2019-02-1111:
54 . 2594(
200.
200.
30.
114)
mca pts
/3 2019-02-1111:
59 . 2650(
200.
200.
30.
115)
mca pts
/4 2019-02-1111:
59 . 2661(
200.
200.
30.
111)
mca pts
/5 2019-02-1112:
17 . 3066(
200.
200.
30.
107)
mca pts
/6 2019-02-1112:
02 . 2760(
200.
200.
30.
108)
mca pts
/7 2019-02-1112:
04 . 2847(
200.
200.
30.
110)
DATECommand
[
mca@avmca~
]$date
MonFeb1112:
34:
34I
ST2019
[
mca@avmca~
]$date-u
MonFeb1107:
04:
38UTC2019
Date Formatopti
onfordi
spl
ayi
ngpas
tdates
[
mca@avmca~
]$date-
-date="12/
12/
2007"
WedDec1200:
00:
00I
ST2007
[
mca@avmca~
]$date-
-date="2yearago"
SatFeb1112:
36:
16I
ST2017
[
mca@avmca~
]$date-
-date="2monthago"
TueDec1112:
36:
34I
ST2018
[
mca@avmca~
]$date-
-date="10daysago"
FriFeb 112:
36:
48I
ST2019
[
mca@avmca~
]$date-
-date="10mi
nutesago"
MonFeb1112:
27:
12I
ST2019
FutureDateFormats
[
mca@avmca~
]$date--date="
nextmon"
MonFeb1800:
00:
00I
ST2019
[
mca@avmca~
]$date--date="
next2days
"
date:i
nval
iddate`
next2days
'
[
mca@avmca~
]$date--date="
next2day"
date:i
nval
iddate`
next2day'
[
mca@avmca~
]$date--date="2day"
WedFeb1312:
43:
22I
ST2019
[
mca@avmca~
]$date--date="2year"
ThuFeb1112:
43:
48I
ST2021
Date commandsFormats
[
mca@avmca~
]$date '
+%d'
11
[
mca@avmca~
]$date '
+%d'
11
[
mca@avmca~
]$date '
+%a'
Mon
[
mca@avmca~
]$date '
+%A'
Monday
[
mca@avmca~
]$date '
+%D'
02/
11/
19
[
mca@avmca~
]$date '
+%h'
Feb
[
mca@avmca~
]$date '
+%v'
%v
[
mca@avmca~
]$date '
+%b'
Feb
[
mca@avmca~
]$date '
+%B'
February
[
mca@avmca~
]$date '
+%m'
02
[
mca@avmca~
]$date '
+%y'
19
[
mca@avmca~
]$date '
+%Y'
2019
[
mca@avmca~
]$man
Whatmanualpagedoyouwant?
[
mca@avmca~
]$manpri
ntf
GNUcoreuti
lshomepage:<
http:
//
www.
gnu.
org/
software/
coreuti
ls/
>
Generalhel
pus
ingGNUs
oftware:<http:
//
www.
gnu.
org/
gethel
p/>
Report pri
ntf trans
lati
on bugsto <http:
//
trans
lati
onpro-
j
ect.
org/
team/
>
COPYRI
GHT
Copyri
ght© 2010FreeSoftwareFoundati
on,I
nc.Li
cens
e GPLv3+:
GNUGPLvers
ion3orl
ater<http:
//
gnu.
org/
licens
es/
gpl
.html
>.
Thi
sisfree s
oftware:youarefreetochangeandredi
stri
bute
i
t.Therei
sNOWARRANTY,totheextentpermi
ttedbyl
aw.
SEEALSO
pri
ntf(
3)
Theful
ldocumentati
onforpri
ntfi
smai
ntai
nedasaTexi
nfoman-
ual
.If thei
nfoandpri
ntfprogramsareproperl
yins
tal
ledat
yours
ite,thecommand
i
nfocoreuti
ls'
pri
ntfi
nvocati
on'
s
houl
dgi
veyouacces
stothecompl
etemanual
.
GNUcoreuti
ls8.
4 March2011 PRI
NTF(
1)
(
END)
[
mca@avmcamca19]
$ls
area.
sh bi
g.s
h di
sp.
sh number.
sh pras
hanth19 s
ingl
efi
le
bg.
sh cc.
sh even.
sh odd.
sh rohi
t19 s
ingl
e.s
h
bhargav18 ci
rcl
e.s
h mul
.sh pos
iti
ve.
shs
ampl
e.s
cr
[
mca@avmcamca19]
$ls-1
area.
sh
bg.
sh
bhargav18
bi
g.s
h
cc.
sh
ci
rcl
e.s
h
di
sp.
sh
even.
sh
mul
.sh
number.
sh
odd.
sh
pos
iti
ve.
sh
pras
hanth19
rohi
t19
s
ampl
e.s
cr
s
ingl
efi
le
s
ingl
e.s
h
[
mca@avmcamca19]
$cal32019
March2019
SuMoTuWeThFrSa
12
3456789
10111213141516
17181920212223
2425262728293031
[
mca@avmcamca19]
$cal32005
March2005
SuMoTuWeThFrSa
12345
6 7 8 9101112
13141516171819
20212223242526
2728293031