Kishinchand Chellaram College, Mumbai – 20.
FY / SY / TY B.Sc. (I.T.) Semester_______
Practical 1
Introduction to Basic Linux Commands and Editors
Basic Commands Used:
1. cat > filename
Using this command, we can create file and write
2. cat filename
It allows user to view the content
3. touch
It allows user to create empty file
Kishinchand Chellaram College, Mumbai – 20.
FY / SY / TY B.Sc. (I.T.) Semester_______
4. cat file1 > file2
It copies the content of file 1 to file 2 .it overwrites the content of file
5. cat file1 >> file3
It copies the content of file 1 to file 3 .it doesn’t overwrite the content of file.
6. cp file1 file 3
It copies the content file1 to file3
7. rm –i file3
It asks before deleting any file.
Kishinchand Chellaram College, Mumbai – 20.
FY / SY / TY B.Sc. (I.T.) Semester_______
8. rm –rf file2
It removes file forcefully.
9. ls –a
It shows all the files
10. ls f*
It shows the files starting with f
Kishinchand Chellaram College, Mumbai – 20.
FY / SY / TY B.Sc. (I.T.) Semester_______
11. ls ?4
It displays the list of file with any character as first character and ‘4’ following it
12. ls [ahf]*
It lists files starting with names a,h,f
13. ls –l
It is used for long listing of files
Kishinchand Chellaram College, Mumbai – 20.
FY / SY / TY B.Sc. (I.T.) Semester_______
14. chmod 777 filename
It is used for changing the file permissions
15. mkdir dirname
It creates new directory
16. mkdir –p dirname
It will create a directory using path
Kishinchand Chellaram College, Mumbai – 20.
FY / SY / TY B.Sc. (I.T.) Semester_______
17. rmdir dirname
It removes directory
18. grep write
It searches for write word
19. head filename
It will give first 10 lines of the file by default
Kishinchand Chellaram College, Mumbai – 20.
FY / SY / TY B.Sc. (I.T.) Semester_______
20. head –number filename
It will give the specified number of lines of the file
21. tail filename
It will give last 10 lines of the file by default
22. tail filename –n number
Kishinchand Chellaram College, Mumbai – 20.
FY / SY / TY B.Sc. (I.T.) Semester_______
It will give the last number of lines of the file
The VI Editor
When we type the command ‘vi’ on the Terminal and press enter, it will go to the vi editor mode.
In the VI Editor, when you press I, it will take you to ‘Insert Mode’.
Inside the Insert Mode, we can write anything we want to.
When you want to save the contents written in VI editor, press ‘Esc’.
After pressing Esc button, to exit the Editor, press ‘:wq’ (Colon then press w and q)
Kishinchand Chellaram College, Mumbai – 20.
FY / SY / TY B.Sc. (I.T.) Semester_______