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

Directory Oriented Command.

The document discusses various Linux commands for directory, file, and permission management. It provides descriptions and examples of commands like ls, mkdir, rmdir, cd, pwd, find, du, df, cat, cp, rm, mv, wc, ln, file, cmp, comm, chmod, chown, chgrp, and touch. Examples are given for listing, creating, deleting, copying, moving, comparing files and directories, as well as changing permissions and ownership. The dd command is also introduced for converting file formats by changing letter cases.

Uploaded by

Rohan18 Patel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Directory Oriented Command.

The document discusses various Linux commands for directory, file, and permission management. It provides descriptions and examples of commands like ls, mkdir, rmdir, cd, pwd, find, du, df, cat, cp, rm, mv, wc, ln, file, cmp, comm, chmod, chown, chgrp, and touch. Examples are given for listing, creating, deleting, copying, moving, comparing files and directories, as well as changing permissions and ownership. The dd command is also introduced for converting file formats by changing letter cases.

Uploaded by

Rohan18 Patel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

OSV ASSIGNMENT-I

 Aim :- Give an output and description of all “ LINUX COMMAND “

 Directory oriented commmand’s…

1. Ls command :-
i. ls – This command is used to list content of specific directory.
ii. ls -a - This command is used to list content of specific directory including Hidden files.
iii. ls -l – This command lists the files in long format with file type, permission, number of
links, owner of file, file size, modification time, etc.
iv. ls -r – This command is used to list content of specific directory in Reverse Order.
v. ls -t – This command is used to list the files sorted by Last Modification Time.
vi. ls -R – This command Recursively list all the files and sub-directories as well as files in
Sub-directories.
vii. ls -p – This command puts slash after each directories.
viii. ls -s – This command display the number of Storage Blocks used by a file.
ix. lsi -x – This command lists content by lines instead of by column in sorted order.

1
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
2
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
2. mkdir commands :- mkdir means make directory. This command is used to create new
directory…

3. rmdir command :- rmdir means remove directory. This command is used to delete empty
Directory.

4. cd command :-
i. cd – cd means Change Directory. This command is used to change the current Working
directory to specific directory.
ii. cd .. - This command let you bring as Parent directory (abc) as a Working directory.

3
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
5. pwd command :- pwd means Print Working Directory. This command display full path name of
Current working directory.

6. find command :- This command recursively examines the specific directory tree to look for file
Matching some file attributes, & then takes some specified action on those files.

4
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
7. du command :- du means disk usage. This command allows the user to gain disk usage of all
files very quickly of a specified directories, including all its sub-directories.

5
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
8. df command :- df means Disk Free. This command display the amount of available space for File
system on which user has access.

6
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
 FILE ORIENTED COMMANDS

1. cat command :- This command is used to display content of specified files.


i. cat > om.txt -This command is also used with > operator to create new file. From this
command, file named om.txt
ii. cat om.txt - This below command will display content of om.txt.

2. cp command :- cp means Copy. This command is used to copy of content of 1 st file to 2nd
file.

7
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
3. rm command :- rm means Remove. This command is used to remove specific file from
current Working directory.

4. mv command :- mv means Move. This command is used to rename specific file or directory
i. mv hello.txt hii.txt - This below command will rename file named from x.txt to y.txt.

5. wc command :- wc means Word Count. This command is used to display the number of
lines, words & Characters of information stored in the specified file
i. wc hi.txt - Here 2 denotes number of lines, 3 denotes number of words & 18 denotes
Number character in a file named hi.txt.
ii. wc -l hi.txt - l is used to display only number of lines
iii. wc -w hi.txt -w is used to display only number of words
iv. wc -c hi.txt -c is used to display only number of character.

8
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
6. Ln command :- ln means Link This command is used to create a hard or symbolic link to an
existing File or directory.

7. File command :- This command used to determine the type of a file. It may be of ASCII text,
C program text, empty or other.

8. cmp command :- cmp means Compare. This command is used to compare 2 files.

9. comm command :- comm means Common. This command produces 3 column output
where 1st Column contains lines unique to FILE1, 2 nd column contains line unique to FILE2 &
3rd column contain lines common to both the files. It works only if you Are comparing 2 files
which are already sorted.

9
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
 FILE ACCESS PERMISSION

1. chmod command :- chmod means Change Mode. This command is used to change the
permission Of the given file.

 In this command outputs -rwxrw-r-x indicates:


 Permission of ADMIN / USER (u)
 Permission of GROUP (g)
 Permission of PUBLIC / OTHER (o)

R – READ permission (4)

W – WRITE permission (2)

X – EXECUTE permission (1)

And 0 for NO permission.

i. chmod g+x a.txt - In this command as there is + sign it will add EXECUTE permission Toward
Group side.
ii. chmod o+rx a.txt -In this command as there is + sign it will add EXECUTE & READ Permission
toward Other side.
iii. chmod o-rx a.txt -In this command as there is – sign it will remove EXECUTE & READ permission
from Other side.
iv. chmod 764 a.txt - In this command as 764 is used. 7(4+2+1) denoted permission of USER
/ADMIN. So user will have rwx (read, write, execute) permission. 6(4+2) denotes permission of
GROUP. So group will have rw (read, write) Permission & 4(4) denotes permission of OTHER /
PUBLIC. So other Will have only r (read) ppermission
v. chmod g+x,o+x a.txt -In this command EXECUTE permission will be added to Group as Well as
Other / Public side
vi. chmod ugo=r a.txt -In this command READ permission will be added to Admin , Group & Oher
side. & All other permission will be removed.

10
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
11
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
2. chown command :- chown means Change Ownership. This command is used to change
Ownership of a specified file. Only owner of the file and super user can Change the ownership of
specified file.
3. chgrp command :-chgrp means Change Group. This command is used to change Group
Ownership of a specified file. Only owner of the file and super user can Change the Group
ownership of specified file.
4. touch command :-This command is used to change the last modification and access time of a
Specified file into the specific time. If MMDDHH expression is not Used, then the current date
and time are taken by default.

MM – Month (01-12)

DD - Day (01 -31)

HH - Hour (00 – 23)

Mm – Minute (00 – 59)

5. dd command:- This command copies files & converts them in one format into another.
i. dd if=”hack.txt” of=”HACK.txt” conv=ucase :- ucase – converts lowercase letter to
uppercase.
ii. dd if=”HACK.txt” of=”lower.txt” conv=lcase :- lcase – converts uppercase letter to lowercase.

12
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
6. expand command :- This command converts all the tabs present in the specified file into blank
Spaces and display the result on the screen.

Eg- expand exp.txt

Then

13
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
Cat exp.txt > exp1.txt :- exp.txt is original file and exp1.txt is expanded file

7. nl command :-This command is used for numbering line (non-blank lines) of specified text &
display

14
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
8. tac command :-This command is used to concatenate and print the file in reverse, so that the
Last line becomes the first.

9. tail command :-This command prints last N number of data of the given input. By default it
prints Last 10 lines of the specified files.

10. head command :– This command prints top N number of data of the given input. By default it
prints First 10 lines of the specified files.

 PROCESS ORIENTED COMMANDS

1. ps command :- ps means Process Status. This command is used to view / display information
related. To the process running in the Linux system.

15
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
2. Kill command :- This command is used to terminate the background process. By default it used
signal Number 15 to terminate the process. In some cases if this number does not works then
Signal number 9 is used to kill the process which refer as a sure kill

Eg :- kill -9 7481 - In this example 7481 is a PID which will get terminated by hitting Enter button.

3. nohup command :- nohup means NO Hang up. This command keeps processes running even
after Exiting the shell or terminal.

4. at command :- This command allows you to schedule commands to be executed at particular


time.
i. at 6:56

At> echo “lunch break”

Ctrl+d :- This command will run at 6.56.

ii. atq -atq command is used to list the jobs submitted by you on at queue. & this command
will run tomorrow at 6.56.

16
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
5. batch command :- This command is used to execute the specific command when system loads
permit. (when CPU nearly becomes free).

17
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
 COMMUNICATION ORIENTED COMMANDS

1. write – This command is used to send a message to another user. It allows the user To communicate
with other user through terminal.
2. mail – This command allows user to send emails from the command line.
3. wall – This command is used by the super user to send message to all user who are Currently logged
on the system.

 GENERAL PURPOSE COMMANDS

1. date- This command is used to display system’s date and time


i. date +%H :- %H -> Hours (00 – 23)
ii. date +%I :- %I -> Hours (00 – 12)
iii. date +%M :- %M -> Minutes (00 -59)
iv. date +%S :-%S -> Seconds (00 – 59)
v. date +%D :-%D -> Date (MM/DD/YY)
vi. date +%T :-%T -> Time (HH:MM:SS)
vii. date +%w :-%w -> Day of week (0=sun, 1=mon, …)
viii. date +%r :-%r -> Time in AM / PM
ix. date +%y :-%y -> Last two digit of year

18
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
2. who – This command is used to display the user who are currently logged on the system.

19
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
3. who am I – This command displays the username of the current user when this Command is
invoked.

4. man – This command provides detail view of any Linux command like syntax, when to use That
command, etc.

20
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
5. cal – This command is used to display calendar of any month and of any year.

6. ipr – This command is used to print one or more files on printer.

7. tee – This command is normally used to split the output of a program so that it can Be both
displayed and saved in a file.

i. ls
ls > a.txt

- In this below commands output of ls is sent to standard o/p and also to The file a.txt.

21
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
ii. ls | tee a.txt – this process can be done by singly command instead of using two different
Command.
iii. cat a.txt | tee result.txt - This below command send the output of a.txt to the result.txt and
stores into it.

8. script – This command is used to make typescript or record all the terminal activities. After executing
script command it starts recording everything printed on the Screen including the input and output
until exit.

22
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
9. tput – This command with clear option can be used to clear the screen content.

10. split – This command is used to split the larger file into smaller files.

11. expr – This command is used to evaluate the given expression (only integers) and Display the
corresponding output.

i. x=10
ii. y=5
iii. expr $x + $y
iv. expr $x - $y
v. expr $x \* $y
vi. expr $x / $y
vii. expr $x % $y
viii. expr $x + 55

23
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
12. bc – This command is used to evaluate the given expression (integers as well as float) And display
the corresponding output.

24
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
25
Name :- Om.T.Dave
EnRoll :- 1906301116005
Sub :-Operating system and virtulisation
i

You might also like