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

Linux Commands New

The document provides a comprehensive guide on basic UNIX commands, covering directory management, file operations, process information, and filtering commands. Key commands include creating, moving, copying, and displaying files, as well as managing file permissions and using utilities like 'sort', 'head', and 'grep'. It serves as a practical reference for users to navigate and manipulate files and directories in a UNIX environment.

Uploaded by

ideathoncsb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Linux Commands New

The document provides a comprehensive guide on basic UNIX commands, covering directory management, file operations, process information, and filtering commands. Key commands include creating, moving, copying, and displaying files, as well as managing file permissions and using utilities like 'sort', 'head', and 'grep'. It serves as a practical reference for users to navigate and manipulate files and directories in a UNIX environment.

Uploaded by

ideathoncsb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

EX.

NO:1 BASIC OF UNIX COMMANDS

I.WORKING WITH DIRECTORIES


1.Create a directory:
[2CB101@localhost ~]$ mkdir csbs
[2CB101@localhost ~]$ mkdir cse
[2CB101@localhost ~]$ ls
Csbs cse

2.Change the working directory:


i) change the directory

[2CB101@localhost ~]$ cd csbs


[2CB101@localhost csbs]$ cd ..
[2CB101@localhost ~]$

ii) Move file within directories:


[2CB101@localhost ~]$ mv csbs mech
[2CB101@localhost ~]$ ls
Cse mech

II.WORKING WITH FILE RELATED COMMANDS

3.Creating a file:
[csbs124@cc7linux~]$ cat > basic

[2CB101@localhost ~]$ cat>basic


this is a linux lab
csbs department

4.Display a file:
[2CB101@localhost ~]$ cat basic
this is a linux lab
csbs department
[2CB101@localhost ~]$

5. FILE PERMISSIONS:
(u-user,g-group,o-others) (r-read,w-write,x-execute)
(octal notation for read-4, write-2 ,execute-1
[2CB101@localhost ~]$ ls -l
total 288
rw-rw-r-x. 2 2CB101 2CB101 4096 Jan 1 06:23 basic

[2CB101@localhost ~]$ chmod 741 basic


rwxrw---x. 2 2CB101 2CB101 4096 Jan 1 06:23 basic

6.Append a file:
[2CB101@localhost ~]$ cat>exam
aaaa
bbbb
cccc
[2CB101@localhost ~]$ cat exam
aaaa
bbbb
cccc

[2CB101@localhost ~]$ cat>>exam


ddddd
[2CB101@localhost ~]$ cat exam
aaaa
bbbb
cccc
ddddd
[2CB101@localhost ~]$
6.Concatenation of files:
[2CB101@localhost ~]$ cat>exam
aaaa
bbbb
cccc
[2CB101@localhost ~]$ cat exam
aaaa
bbbb
cccc
ddddd
[2CB101@localhost ~]$ cat>exam1
zzzz
yyyy
xxxx
[2CB101@localhost ~]$ cat exam>>exam1
[2CB101@localhost ~]$ cat exam1
zzzz
yyyy
xxxx
aaaa
bbbb
cccc
ddddd
[2CB101@localhost ~]$
7.Copy a file:
[2CB101@localhost ~]$ cat>qq
444
555
666
[2CB101@localhost ~]$ cp qq qqq
[2CB101@localhost ~]$ cat qqq
444
555
666
8.Move a file:
[2CB101@localhost ~]$ mv qqq zzz
[2CB101@localhost ~]$

9.Comparing files:
[2CB101@localhost ~]$ cmp b b3
b b3 differ: byte 9, line 5
[2CB101@localhost ~]$ cat>b
a
b
c
d
e
[2CB101@localhost ~]$ cat>b3
a
b
c
d
f

10.Difference between files:


[2CB101@localhost ~]$ cat>b
a
b
c
d
e
[2CB101@localhost ~]$ cat>b3
a
b
c
d
f

[2CB101@localhost ~]$ diff b b3


5c5
<e
---
>f

11.List :
[2CB101@localhost ~]$ ls
a a1 abiii cse d32 Desktop fe.txt p
12.Remove:
[2CB101@localhost ~]$ rm a1
[2CB101@localhost ~]$ ls
a a.c d12 d44
13.More:
[csbs124@cc7linux~]$ more b2
14.Additional file name:
[2CB101@localhost ~]$ ln -s b cc
[2CB101@localhost ~]$ ls
15.Present working directory:
[csbs124@cc7linux~]$ pwd
/home/cse240
III.PROCESS AND STATUS INFORMATION COMMAND
16.Date:
[csbs124@cc7linux~]$ date
Sun Dec 31 23:55:10 IST 2000
[csbs124@cc7linux~]$ date +%d
31
[csbs124@cc7linux~]$ date +%m
12
[csbs124@cc7linux~]$ date +%h
Dec
[csbs124@cc7linux~]$ date +%y
00
[csbs124@cc7linux~]$ date +%R
23:55
[csbs124@cc7linux~]$ date +%T
23:55:38

17.Calendar:
[csbs124@cc7linux~]$ cal
December 2000
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31

18.Binary calculator:
[csbs124@cc7linux~]$ bc
bc 1.06
5*4
20

19.Who :
[csbs124@cc7linux~]$ who
cse319 pts/1 Dec 31 23:04 (132.147.162.8)
cse318 pts/2 Dec 31 23:51 (132.147.162.7)
cse212 pts/3 Dec 31 23:04 (132.147.162.9)
cse316 pts/4 Dec 31 23:24 (132.147.162.5)

20.Finger command:
[csbs124@cc7linux~]$ finger
Login Name Tty Idle Login Time Office Office Phone
Cse303 cse303 pts/22 Dec 31 23:10 (132.147.162.11)
Cse322 cse322 pts/3 1 Dec 31 23:04 (132.147.162.9)
Cse324 cse324 pts/8 1 Dec 31 23:06 (132.147.162.10)
cse325 cse325 pts/13 Dec 31 23:19 (132.147.162.1)
cse326 cse326 pts/11 Dec 31 23:55 (132.147.162.2)
cse332 cse332 pts/9 Dec 31 23:06 (132.147.162.3)
cse335 cse335 pts/7 1 Dec 31 23:05 (132.147.162.4)
cse338 cse338 pts/4 Dec 31 23:24 (132.147.162.5)
cse340 cse340 pts/10 2 Dec 31 23:32 (132.147.162.27)
cse346 cse346 pts/2 Dec 31 23:51 (132.147.162.7)

21.Who am i:
[csbs124@cc7linux~]$ who am i
cse240 pts/11 Dec 31 23:55 (132.147.162.2)

22.Man:
[csbs124@cc7linux~]$ man date
DATE(1) User Commands DATE(1)
NAME
date - print or set the system date and time
SYNOPSIS
date [OPTION]... [+FORMAT]
date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
DESCRIPTION
Display the current time in the given FORMAT, or set the system
date.

-d, --date=STRING
display time described by STRING, not ânowâ

-f, --file=DATEFILE
like --date once for each line of DATEFILE

[1]+ Stopped man date

23.Word count:
[csbs124@cc7linux~]$ wc new
wc new
6 85 557 new
[csbs124@cc7linux~]$ wc -w new
85 new
[csbs124@cc7linux~]$ wc -c new
557 new
[csbs124@cc7linux~]$ wc -l new
6 new

24.Echo:
[csbs124@cc7linux~]$ echo

25.Read:
[csbs124@cc7linux~]$ read a
5
[csbs124@cc7linux~]$ echo $a
5

26.Terminal line:
[csbs124@cc7linux~]$ tty
/dev/pts/11

27.Adding line number to file:


[csbs124@cc7linux~]$ nl new
1 multitasking is the capability of the operating system to peerform various tasks.A
single user can perform various tasks.
2 every user can have a login name and a password .so, accessing another users data
is impossible without permission.

28.Which :
[csbs124@cc7linux~]$ which date
/bin/date
[csbs124@cc7linux~]$ which new
/usr/bin/which: no new in (/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr
/X11R6/bin:/home/cse240/bin)

IV.FILTER COMMAND
29.Sorting:
[csbs124@cc7linux~]$ cat new
multitasking is the capability of the operating system to perform various tasks.
A single user can perform various tasks.
every user can have a login name and a password .
[csbs124@cc7linux~]$ sort new
every user can have a login name and a password .
multitasking is the capability of the operating system to perform various tasks.
A single user can perform various tasks.

[csbs124@cc7linux~]$ sort -r new


multitasking is the capability of the operating system to perform various tasks.
A single user can perform various tasks.
every user can have a login name and a password .

[csbs124@cc7linux~]$ sort -u new


every user can have a login name and a password .
multitasking is the capability of the operating system to perform various tasks.
A single user can perform various tasks.

[csbs124@cc7linux~]$ sort -n new


communication is between different terminals.
every user can have a login name and a password .
multitasking is the capability of the operating system to perform various tasks
.A single user can perform various tasks.

30.Head:
[csbs124@cc7linux~]$ head new
multitasking is the capability of the operating system to perform various tasks.
A single user can perform various tasks.
every user can have a login name and a password .

[csbs124@cc7linux~]$ head -2 new


multitasking is the capability of the operating system to perform various tasks.A single
user can perform various tasks.
every user can have a login name and a password .so, accessing another users data is
impossible without permission.

31.Tail:
[csbs124@cc7linux~]$ tail new
multitasking is the capability of the operating system to perform various tasks.
A single user can perform various tasks.
every user can have a login name and a password .
[csbs124@cc7linux~]$ tail -2 new
Necessary ingredients like conditional and control structures and variables.
communication is between different terminals.

32.Cut:
[csbs124@cc7linux~]$ cut -c1-3 new
mul
eve
UNI
os
UNI
com

[csbs124@cc7linux~]$ cut -r1-3 new


cut: invalid option -- r
Try `cut --help' for more information.
[csbs124@cc7linux~]$ ls
latest new

33.Paste:
[csbs124@cc7linux~]$ paste new latest
multitasking is the capability of the operating system to perform various tasks.A single
user can perform various tasks. multitasking is the capability of the operating system to
perform various tasks.A single user can perform various tasks.

34.Grep:
[csbs124@cc7linux~]$ grep "between" new
os is used to have interface between system and user.
communication is between different terminals.

35.Common:
[csbs124@cc7linux~]$ comm new latest
multitasking is the capability of the operating system to peerform various
tasks.A single user can perform various tasks.
every user can have a login name and a password .so, accessing another users
data is impossible without permission.
os is used to have interface between system and user.
communication is between different terminals.

36.Pipes:
[csbs124@cc7linux~]$ who | wc -l
22

You might also like