To Study About The Basics of UNIX and Basic UNIX Commands
To Study About The Basics of UNIX and Basic UNIX Commands
COMMANDS
E
x INTRODUCTION TO
. UNIX AND BASIC
N UNIX COMMANDS
o
:
1
AIM:
UNIX:
LINUX:
STRUCTURE OF A LINUXSYSTEM:
It consists of three parts.
a) UNIX kernel
b) Shells
UNIX KERNEL:
SHELL:
CONTENT:
Note: Syn->Syntax
a) date
–
used to
check the
date and
time Syn:
$date
b) cal
–
used
to
displ
ay
the
cale
ndar
Syn:
$cal
2
200
9
c)echo
Syn:$echo “text”
ls[a-m]*List all the files whose name begin with
alphabets From „a‟ to „m‟ ls[a]*List all the files whose
name begins with „a‟ or „A‟
Eg:$ls>my list Output of „ls‟ command is stored to disk file named „my list‟
d) lp
–
u
s
e
d
t
o
t
a
k
e
p
r
i
n
t
o
u
t
s
S
y
n
:
$
l
p
f
i
l
e
n
a
m
e
e) man
Syn:$who$whoami
g)uptime
–tells you how long the computer has been running since its last reboot
or power-off.
Syn:$uptime
h) uname
i)hostname
–
displays
and set
system
host
name
Syn:$
hostnam
e
j) bc
10/2 sca i s
*3 le b q
=1 a r
s t
e (
= 1
2 9
6
)
15 2.2 o 1
5+ b 4
1 a
s q
e u
= i
1 t
6
3.3 1
5 1
0
1
0
0
1
1
qu 8
it 9
2
7
5
1
0
1
0
Q
u
i
t
$bc $
b
c
-
l
for(i s
=1;i< c
3;i=i a
+1)I l
e
=
2
1 s
(
3
.
1
4
)
2 0
3
quit
Creation:
Syn:$cat>filename
Viewing:
Syn:$cat filename
Syn:$cat>>filename
Concatenate:
Syn:$catfile1file2>file3
$catfile1file2>>file3 (no over writing of file3)
c) rm
–deletes a
file from
the file sys-
tem Syn:
$rm file-
name
d) touch–used to create a blank file.
e)
cp–
copies
the
files
or dir-
ector-
ies
Syn:
$cp-
sourc
e file
des-
tina-
tion
file
Eg:
$cp
stu-
dent
stud
f)
mv–to
rename
the file
or dir-
ectory
syn:
$mv old
file new
file
$cut –c1-4 f5
$cut–f 3,6emp
$ cut –f 3-6 emp
-c cutting columns
-f cutting fields
h) head–displays10
lines from the head(top)of a
given file Syn:$head filename
Eg:$head student
To display the top two lines:
i) t
ail–dis-
plays last
10 lines
of the
file Syn:
$tail file-
name
Eg:$tail student
To display the bottom two lines;
Syn:$ tail -2 student
j) chmod–used to change
the permissions of a file or direct-
ory. Syn:$ch mod category
operation permis-
sion file Where, Category–is the
user type
Operation–is used to
assign or remove
permission
Permission–is the
type of permission
C Operati P
a on e
t r
e m
g i
o s
r s
y i
o
n
u +assign r
– –
-
u remove r
s
e e
r a
s d
g =assign w
– –
absolu
g
r tely
w
o
u r
p i
t
o e
–
x
o
-
t
h e
e x
r e
s c
u
t
e