Shell command - User group management of userdel, groupadd

Document and content processing - userdel, groupadd

1. userdel: Delete User

Userdel command function description

userdelCommand is used to delete user accounts. userdelYou can delete a user account and related files. Without additional parameters, only delete a user account without deleting the related files.

Userdel command syntax

userdel[Options] login
userdel[-r] [user account]

Description of common parameters userdel command:

userdelSmall parameters in Table 1 for the userdelparameters and descriptions of commands:

Table 1: userdel Parameters and descriptions of commands

Parameter options explain
-r User login directory and delete all the files in the directory.

Userdel command of practical operation

Example 1: delete user accounts

userdel hnlinux

2. groupadd: Add User Group

Description groupadd command functions

groupmodCommand changes the group ID or name. When you need to change the identification code or name of the group, you can groupmodcommand to do the job.

Groupadd command syntax

groupadd[Option] Group
groupmod[-g <group ID> <-o>] [- n < new group name>] [Name Group]

groupadd commands commonly used parameters Description:

groupaddSmall parameters in Table 1 for the groupaddparameters and descriptions of commands:

Table 1: groupadd Parameters and descriptions of commands

Parameter options explain
-g <Group ID>   To use the setting group identifier.
-O   Reuse group ID.
-n <new group name>   Set To use the group name.

Hands-groupadd command

Example 1: Modify the group name

[root@test~]# groupadd linuxso 
[root@test ~]# tail -1 /etc/group 
linuxso:x:500: 
[root@test ~]# tail -1 /etc/group 
linuxso:x:500: 
[root@test ~]# groupmod -n linux linuxso 
[root@test ~]# tail -1 /etc/group 
linux:x:500:

Today I write to you, have any questions or something goes wrong, feel free to enlighten the great God who comment

Guess you like

Origin blog.51cto.com/14068656/2409955