❖ Operating System Lab File:-
1. pwd:- stands for "print working directory".
• It will print the current folder path.
2. mkdir :- stands for "make directory".
• you can create folder using mkdir command.
• you can create multiple folders with one command.
• you can also create nested folder using -p option in mkdir
command
• The -p flag creates parent directories as needed..
• This command can also be used to create a hidden folder just add
(.) in starting.
3. dir :-
• dir command in Linux is used to list the contents of a directory.
• For detailed information about each file, use the -l option
4. cd :-
• This command is used to change directory.
• To exit from any directory use (..) ahead of this command
5. rm :-
• The rm command is used to delete (remove) files or directories.
• It stands for "remove".
• rm -rf directory name (Forcefully delete all commands without
confirmation)
6. rmdir :-
• This command is used to delete a blank directory .
• This command is used to remove multiple directories at once
7. echo :- This command is used to directly print a message.
• This command can also be used to create a empty file
◼ This command can also be used to create a file with text in it.
8. touch :-
• This command is used to create new file
• If the file already exists this command will update the timestamp of
the file
• touch command can also be used to create a hidden file just start
the name with (.).
• -m option is used to update only the modification time of a file
9. stat :-
• This command is used to get statistical data of a file.
10. cat :-
• This command is used to insert text in any file and then print the
content of file.
• cat command can also be used to show contents of multiple files.
• cat command can also be used to concatenate two files in an another
file .
• If we use (-n) option with command then we can get number of lines
in a file
11. ls :-
• This command is used to list directory contents.
o THE ONE in BLUE is directory and other are files.
• -l option is used to list with detailed information.
• -a option is used to view all hidden files that one starting with .
12. sort :-
• It is used to sort lines of a file numerically, alphabetically or in reverse
order.
• To sort in reverse order use -r option
• To sort numerically use -n option
• -u option removes duplicated while sorting
13. mv :- It stands for "move".
• This command can be used to Move files/directories from one location
to another.
• This command can also be used to rename a file.
14. cp :-
• This command is used to copy file.
• This command can also be used to create a new file and copy the data
to that file
15. head :-
• This command can be used to print the starting 10 lines(default) of a
file.
• By using -n option we can print first n lines
• We can also see the first few lines of multiple files.
16. tail :-
• This command can be used to print last 10 lines (default) of a file.
• By using tail -n option you can print last n number of lines.
17. Find :-
• This command is used to search for files and directories within a
directory.
• it’s used to search for files and directories based on
name, type, size, date, and more.
18. tree :-
• The tree command shows a visual hierarchical structure of directories
and files.
• To install use command sudo apt install tree.
• tree -s is used to print sizes .
• tree -a is used to print hidden files in tree
• tree -d is used to print directories only
19. df :-
• The df command is used to display disk space usage of file systems.
• df -h is used to show specific file system
• df -T is used to Include file system type
20. top :-
• The top command is used to monitor system performance in real-time
• It shows CPU usage, memory usage running processes.
21. chown :-
• Chown command in Linux is used to change the ownership of files
and directories.
• We can also use chown command to change only the group
• We can also change both ownership and group at same time
22. history :- the history command in linux is used to view a list of previously
executed comman
23. man :-
• This command is used to get manual of any command q
24. whereis :-
• it is used to locate the binary, source and manual page files for a
command.
25. ps :-
• The ps command is used to display information about running
processes.
• ps -e will show all ongoing processes.
• ps -aux command is used to get detailed view of all processes
• ps -u username command is used to see the process if a specific user.
26. free :-
• Free command is used to display the amount of free and used memory
• free-h This command is used to show values in human- readable
format
27. kill :-
• The kill command is used to terminate a running process using its
Process ID.
28. clear :-
• This command is used to clear the terminal screen
29. which
• It Shows the exact path to the executable used in your shell.
30. whereis
• It is used to locate the binary , source and manual page files for a
command.
31. sudo :-
• sudo command is used to install a package.
• create new user using
• sudo command i=can also be used to delete a user
32. chmod:-
• It is used to change permissions of a file.
• There are three types of access : owner , group , others
• There are three types of permissions also: read (r=4) , write (w=2) , execute
(x=1).
• User (u)
• Group(g)
• Others(o)
• All(a) = u+g+o
33. tar:-
• It is uses to create an archive file with .tar , .tar.gz , .tgz extensions.
• Here in -czvf stands for : c : create
z = gzip
v = verbose
f = filename
34. zip:-
• It is used to compress files and directories into .zip format.
• zip -r : recursively zips a directory.
• unzip files:-
35. sed:- It is used to edit or replace , insert or delete text in files.
36. Pipeline:- It is used to chain or combines two commands together.
37. grep:- It is used to search the patterns or text in files.
• grep -i : it ignores the case sensitivity
• grep -n : shows the line numbers.
• grep -E : used to allow extended regex ( using | for or).
• grep -v : shows text that don’t match.
• combination of two commands :
o grep -Ev
• with other commands :
o ps aux | grep nginx.