Linux Commands for Lab Practice.
1. exit to end a current session as well current terminal logging
Syntax: [root@nettech root] exit
2. man to view the mannual page of commands for syntax
Syntax: [root@nettech root] man command name
3. info to view the information about any command
Syntax: [root@nettech root]#mkdir info
4.--help to view the help doccuments of a command
Syntax: [root@nettech root]#commandname --help
5. dir to view the subdirectories and files under the directory
Syntax: [root@nettech root]#dir
6. su - to become a super user
Syntax:[mango@nettech mango]$su -output wil be [root@nettech root#]
7. who by this command you can see the user name and their ip addresses
Who have logged in on your server?
Syntax: [root@nettech root]#who
8. whoami this command shows your current logged in terminal user name
Syntax: [root@nettech root]#whoami
9. who am i this command shows you the logged in terminal number and user
name and more detailed information
Syntax:[root@nettech root]#who am i
10.find / -name to find any file or directory in linux file system
Syntax: [root@nettech root]#find / -name filename
11. su username to switch from one user to another users home directory
Syntax: [root@nettech root]#su mango
output will be
[mango@nettech root]#cd
[mango@nettech mango]#
12.su - username to switch from one user to another user users home
directory directly
Syntax:[root@nettech root]#su – mango
13.useradd to create a new user
Syntax:[root@nettech root]#useradd username
14. passwd to give a password to a user
Syntax:[root@nettech root]#passwd tarun (tarun is the user name)
Confirm password:(again type the same password)
15. userdel to remove a user from linux
Syntax: [root@nettech root]#userdel tarun
16. groupadd to add a new group
Syntax:[root@nettech root]#groupadd groupname
17. gruopdel to delete a group
Syntax: [root@nettech root]#groupdel groupname
18. chown to change the ownership of a file or directory
Syntax:[root@nettech root]#chown ownername filename
Example:
[root@nettech /]#ls -l
output
drwxrw-rw- 2 root root 4096 Mar 11 12:03 abcd
(permission) (own) (group own)(size) (name)
[root@nettech root]#chown tarun /abcd
In this example /abcd directory owner will be change to tarun user
effect
[root@nettech /]#ls -l
drwxrw-rw- 2 tarun root 4096 Mar 11 12:03 abcd
19. chgrp to change the group ownership of a file or directory
Syntax: [root@nettec root]#chgrp newgroupownername filename
Example
[root@nettech /]#ls -l
drwxrw-rw- 2 tarun root 4096 Mar 11 12:03 abcd
[root@nettech root]#chgrp tarun /abcd
effect
[root@nettech /]#ls -l
drwxrw-rw- 2 tarun tarun 4096 Mar 11 12:03 abcd
20. usermod to modify the user profile
Syntax:[root@nettech root]#usermod -parameter groupname username