35 Basic and Important Commands of Linux OS
When we start using Linux at least we should know the below basic commands.
1. ls -l To list the files as well as directories those are kept in the particular working directory
Syntax
[root@sonaby]#ls -l
2. ls -la Same use as 'ls -l' but this command helps to see the hidden files.
Syntax
[root@sonaby]#ls -la
3. ls -li Same as 'ls -la' but it will also shows the Inode number of each and every file
Syntax
[root@sonaby]#ls -li
4. ls To see only file name.
Syntax
[root@sonaby]#ls
5. clear To clear the screen (short cut Ctrl+l)
Syntax
[root@sonaby]#clear
6. exit To end a current session
Syntax
[root@sonaby]exit
7. touch To create a new empty file
Syntax
[root@sonaby]#touch
8. cd To change the working/present directory
Syntax
[root@sonaby]#cd /home/test
9. cat To view the contents of a file and it is also used for creating a new file with some contents
Syntax
[root@sonaby]#cat <file name> to view file contents
10. mkdir To make a new directory
Syntax
[root@sonaby]#mkdir newdirname
You can also create a directory at your desired path without changing your present working directory.
Syntax
[root@sonaby]#mkdir /home/test/sample
11. rm To remove a empty file
Syntax
[root@sonaby]#rm filename
12. rmdir To remove an empty directory
Syntax
[root@sonaby]#rmdir directoryname
13. rm [-i/-r/-f] To remove a directory with its subdirectories as well as its files.
Syntax
[root@sonaby]#rm -i directory/filename
-i stands for interactively
-r stands for recursively
-f stands for forcefully
14. cp To copy syntax
[root@sonaby]#cp sourcepath destinationpath
15. mv To move one file or directory from one place to another place, it
is also used for renaming a directory or file
Syntax
[root@sonaby]#mv source destination
[root@sonaby]#mv oldfilename newfilename [to change the file name]
16. man To view the manual page of commands for syntax.
Syntax
[root@sonaby]#man commandname
17. info To view the information about any command
Syntax
[root@sonaby]#mkdir info
18. --help to view the help documents of a command
Syntax
[root@sonaby]#commandname --help
19. dir To view the subdirectories and files under the directory
Syntax
[root@sonaby]#dir
20. su - To become a super user
Syntax
[testuser@sonaby]$su -
Output will be;
[root@sonaby#]
21. who By this command you can see the user name and their IP addresses who have logged on your server
Syntax
[root@sonaby]#who
22. whoami This command shows your current logged in terminal user name
Syntax
[root@sonaby]#whoami
23. who am i This command shows you the logged in terminal number and user
Name and more detailed information
Syntax
[root@sonaby]#who am i
24. pwd To view the present working directory
Syntax
[root@sonaby]#pwd
25. rpm -ivh To install a rpm package
Syntax
[root@sonabt]#rpm -ivh packagename.rpm
rpm stands for 'redhat package manager'
-i stands for install
-v stands for verbose mode
-h stands for with hash sign(#)
26. rpm -q To querry about any rpm package
Syntax
[root@sonaby]#rpm -q packagename
27. rpm -e To uninstall a rpm package
Syntax
[root@sonaby]#rpm -e package
28. find / -name To find any file or directory in Linux file system
Syntax
[root@sonaby]#find / -name filename
29. su username To switch from one user to another user
Syntax
[root@sonaby]#su testuser
output will be;
[testuser@sonaby]#cd
[testuser@sonaby]#
30. su - username to switch from one user to another user users home
Directory directly
Syntax
[root@sonaby]#su - testuser
31. useradd To create a New user
Syntax
[root@sonaby]#useradd username
32. passwd To give a password for a user
Syntax
[root@sonaby]#passwd testuser
Output will be;
Give a password for user testuser:(here you have to type a password for the user)
Confirm password : ( Again type the same password)
33. userdel To remove a user from Linux
Syntax
[root@sonaby]#userdel testuser
34. groupadd To add a new group
Syntax
[root@sonaby]#groupadd groupname
35. groupdel To delete a group
Syntax
[root@sonaby]#groupdel groupname
Comments
Post a Comment