0% found this document useful (0 votes)
43 views51 pages

Sana1 Linux

The document provides descriptions of various Linux commands and their syntax. It covers commands for viewing files and directories (ls, cat), manipulating files and directories (mkdir, mv, cp, rm), displaying system information (who, uptime, uname), and performing operations on files like sorting, counting and searching (sort, grep, wc). The document is divided into multiple assignments with each focusing on a set of related commands and providing their syntax and usage.

Uploaded by

VisheshAnand
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)
43 views51 pages

Sana1 Linux

The document provides descriptions of various Linux commands and their syntax. It covers commands for viewing files and directories (ls, cat), manipulating files and directories (mkdir, mv, cp, rm), displaying system information (who, uptime, uname), and performing operations on files like sorting, counting and searching (sort, grep, wc). The document is divided into multiple assignments with each focusing on a set of related commands and providing their syntax and usage.

Uploaded by

VisheshAnand
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/ 51

Assignment-1

1) ECHO
Syntax-Echo hello
Description-it is used for display a line of text

2) who am i
Syntax:- Who am i
Description:- it is used for print effective user id

3 ) whoami
Syntax:- whoami
Description:- it is used to print effective user id

4 ) who
Syntax:- Who
Description:- it is used to show who logged on

5 ) Clear
Syntax:- clear
Description:- it is generally used for clear the screen

6 ) Calendar
(a) cal
Syntax:- cal
Description:- it is generally used for display the current month of the calendar

(b) Cal 09
Syntax:- cal 09
Description:- it is generally used for display the calendar of the year.

(c) Cal 09 1752


Syntax:- cal 09 1752
Description:- it is generally used for view the specific calendar as per the user.

7 ) Date
Syntax:- date
Description-it is used for print current date

8 )Uptime
Syntax:- Uptime
Description :-it is used to display the on time of server

9 ) Uname
Syntax:- Uname
Description :- it is used to display the system information

10 ) Logname

Syntax :- Logname
Description-it is used to display the user name

11 ) Ulimit
Syntax:- Ulimit
description- it is used to display the set or report file size limit

12 ) Dir
Syntax:- Dir
Description:- it is used to show the list directory contents

13 ) Man

Syntax:- Man
Description-it is used to display system documentation

14 ) Hostname
Syntax:- Hostname
Description-it is used to show the system host name

15 ) TTY
Syntax:- Tty
Description-it is used to show the return users terminal name

Assignment-2

1 ) Pwd
Syntax :- Pwd
Description-it is used to print name of current working directory

2 ) Mkdir
Syntax:- mkdir neha001
Description:- it is used for making the directory

3 ) cd
Syntax-:cd neha001
Description-it is used to show the current directory where we are working

4 ) cd ..
Syntax:- cd ..
Description-its used to exit from the current folder

5 ) Cat to create file


Syntax:- cat>123
Description:- its used to create a file

6 ) Cat to view contents of file


Syntax:- cat 123
Description:- its used to view the file

7) Cat to append to existing file


Syntax:- cat>>123
Description:-

its used to append the file.

8) Cat to create hidden file


syntax:- cat> . dd
Description- its used to create the hidden file

9) Cat to view hidden file


Syntax:- cat .dd

Description:- its used to view the file

10) Cat to append to hidden file


Syntax:- cat>>.dd
Description:- its used for append the file

11) touch
Syntax:- touch neha1 neha2
Touch:- it is used to create empty file.

12) move command


Syntax:- mv neha12 neha143
Description:- it is used for move the contents from one file to another file

13) copy
Syntax:- cp neha001 neha123
Description:- it is used for copy the contents from one file to another

14) whatis
Syntax:- whatis dir
Description:- it is used for know the details of the command.

15)rm
Syntax:- Rm neha12
Description:- its used for removing the file from the directory

16)rm i
Syntax:- rm I neha12
Description:- its used for remove the files with permission

17)rmdir
Syntax:- rmdir neha143
Description:- its used for remove the directory

Assignment-3
1)ls
Syntax:- ls
Description:-its used for view all the file except hidden file

2)ls -1
Syntax:- ls -1
Description:- it is used for viewing the file in vertical way

3)ls r
Syntax: ls r
Description:- it is used for view the file in reverse order

4) ls a
Syntax:- ls a
Description:- it is used for view all the file including hidden files

5) ls l
Syntax:- ls l
Description:- its used for view all the file with the detail

Assignment-4
1)*
Syntax:- d*
Description:- it is generally used for knowing all the file which name starts from d

2) ?
Syntax:- ls neh*143?7
Description:- it is generally used for knowing the missing character file

3) [-]
Syntax:- ls neha143[1-9]
Description:- it is generally used for view the file in range

4) [,]

Syntax:- ls n[1,2,3,4]
Description:- it is generally used for view the specific file

Assignment-5
1) Wc
Syntax:- wc neha143
Description:- it is used to match number of characters

2) Wc l
Syntax:- wc c
Description:- It is used to study the characters in a line

3) Wc w
Syntax:- wc w neha143
Description:- it is used to denote the no of lines in the files

4) wc l
Syntax:- wc l neha143
Description:- it is used to denote the no of lines in the file

Assignment-6
1 ) u+r,g+w,o-x
Syntax:- chmod u+r,g+w,o-x neha
Description:-

2) U+r,g-x,o-r
Syntax:- chmod u+r,g+w,o-x file1
Description:-

3) U-x ,g+x,o+r
Syntax:- chmod u-x,g+r,o+r file1
Description:-

4) u+x,g+x,o-w
Syntax:- chmod u+x,g+x,o-w file1
Description:-

5)770
Syntax:- chmod 770 file1
Description:-

6) 750
Syntax:- chmod 750 file1

Description:-

7 ) 644
Syntax:- chmod 644 file1
Description:-

8) 400
Syntax:- chmod 400 file1
Description:-

9)522
Syntax:- chmod 522 file1
Description:-

10) 502
Syntax:- chmod 502 file1

Description:-

Assignment-7

1) grep pattern filename


Syntax: grep pattern filename
Description: it prints the line of input matches the specified pattern

OUTPUT

2. Syntax: grep c iintm subjects


Description: to count a matching pattern.
Snapshot:

3. Syntax: grep v iitm subjects


Description: avoid that pattern.
Snapshot:

4. Syntax: grep I iitm subjects


Description: it ignores the cases and display all lines.
Snapshot:

5. Syntax: grep n iitm subjects


Description: it display line number with pattern line
Snapshot:

ASSIGNMENT-8
1. Syntax: df
Description: report free disk space.
Snapshot:

2. Syntax: du
Description: estimate files usage.
Snapshot:

3. Syntax: free
Description: display amount of free memory.
Snapshot:

4. Syntax: head file1


Description: output the first part of file.
Snapshot:

5. Syntax: head 25 file1


Description: output of the 17 parts of file.
Snapshot:

6. Syntax: tail file1


Description: output the last part of file
Snapshot:

7. Syntax: tail 6 file *


Description: output the 6 parts of file
Snapshot:

8. Syntax: file file1


Description: it displays the type of file.
Snapshot:

9. Syntax: cmp fb fs
Description: compare two files byte to file.
Snapshot:

10. Syntax: history


Description: to show the history of the command used.
Snapshot:

11. Syntax: more


Description: display file on page by page basis.
Snapshot:

12. Syntax: less


Description: per pragma to request of something.

Snapshot:

13. Syntax: sort filef3


Description: sort lines of text files.
Snapshot:

14. Syntax: sort r filename


Description:sort lines of text files in reverse order.
Snapshot:

15. Syntax: sort n f3


Description: sort lines of text files consist of number in text files.
Snapshot:

Assignment - 9

Redirection
1.Cal>fn
Syntax: cal>neha143
Description:

2. Date>>fn
Syntax: date>>neha143

Description:

3. ls>fn
Syntax: ls>neha143
Description:

4. Sort<fn
Syntax:
Description:

5. Sort<f1>f2
Syntax: sort<neha143>f2

Description:

6. Who|ls l>f4
Syntax: who|ls l>f4

Description:

7. Cat f3|greppattern>fn
Syntax: cat f3|grep 10>neha143

Description:

Pipes

1.Cat fn|grep pattern


Syntax: Cat f3|grep 10
Description:

2. Cat fn|sort r
Syntax: cat teacher|sort r
Description:

3.Who|ls l
Syntax: Who|ls l
Description:

4. ls l|grep pattern
Syntax: ls l|grep 5
Description:

5. ls l|grep pattern|sort r
Syntax: ls l|grep 6|sort r
Description:

6. ls|wc l
Syntax: ls|wc l
Description:

7. who|wc
Syntax: who|wc
Description:

8. Cat fn|wc c
Syntax: cat teachers|wc c

Description:

You might also like