OSLABJATIN
OSLABJATIN
1. pwd:-
It will print the current folder path.
2. mkdir :-
you can create folder using mkdir command.
3. dir :-
dir command in Linux is used to list the contents of a directoryFor
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 :-
This command is used to remove item
rm -rf directory_name Forcefully delete all commands without confirmation
rmdir :-
This command is used to delete a blank directory
This command is used to remove multiple directories at once
6. 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.
7. 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
8. stat :-
This command is used to get statistical data of a file
9. cat :-
This command is used to insert text in any file and then print the content
of file
10. ls :-
This command is used to list directory contents.
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 .
11. 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
12. mv :-
This command can be used to Move files/directories from one location to
another
This command can also be used to rename a file
13. 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
14. 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
15. 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
16. find :-
This command is used to search for files and directories within a directory.
17. tree :-
The tree command shows a visual hierarchical structure of directories and
files.
To install use command sudo apt install tree
18. 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
19. top :-
The top command is used to monitor system performance in real-time
It shows CPU usage, memory usage running processes.
20. 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
21. history :-
The history command in Linux of used to view a list of previously executed
commands
22. man :-
This command is used to get manual of any command q
23. whereis :-
It is used to locate the binary,source and manual page files for a
command
24. ps :-
The ps command in 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
25. free :-
Free command is used to display the amount of free and used memory
This command is used to show values in human- readable format
26. kill :-
The kill command is used to terminate a running process using its
Process ID.
27. clear :-
This command is used to clear the terminal screen
28. sudo :-
sudo command is used to install a package
create new user using
sudo command i=can also be used to delete a user
29. lsof :-
lsof command is used to see which files are currently open
lsof -u username shoes files opened by a specific user
30. hostname:-
This command is used to display or set system’s hostname
31. tar:-
This command is used to create, extract and manipulate archive files
32. zip :-
It is used to compress files and directories into .zip format
c. unzip command
33. grep:-
It is used to search patterns or text in files
grep -i ignores the case sensitivity
grep -n : shows the line numbers
34. sed:-
It is used to replace , insert or delete text in files
35. gpasswd:-
it used for administer.
etc/passwd used to show user.
gpasswd -a is used for add user .
gpasswd -d are used for remove to user.
36. chmod:-
chmod are used for change permission to all file.
To Exit vi
Command Description
:x Save and quit
:wq Save and quit
:q Quit without saving (if no changes)
:q! Force quit without saving
Screen Manipulation
Command Description
^f Move forward one screen
^b Move backward one screen
^d Move down (forward) half screen
^u Move up (backward) half screen
^l Redraw the screen
^r Redraw screen, removing deleted
lines
Adding, Changing, Deleting Text
Command Description
u Undo last change (toggle)