Published on

userdel command-delete user



1 min read
The userdel command is used to delete a specified user and files related to the user. The full English name is "user delete". In fact, the userdel command actually modifies the system's user account files /etc/passwd, /etc/shadow and /etc/group files. This coincides with the Linux system's idea of ​​"all operations are files". It is worth noting that, but if there is a process running related to the user to be deleted, the userdel command usually does not delete a user account. If you really must delete, you can terminate the user process first, and then execute the userdel command to delete. But the userdel command also provides a parameter to face this situation, that is, the "-f" option.


userdel [parameter] [user name]
Command parameters
-f Forcibly delete user accounts
-r Delete the user's home directory and any files in it
-h Display the help information of the command
Delete users, but do not delete their home directories and files:
[root@linuxstar ~]# userdel linuxstar
Delete users, and delete their home directories and files:
[root@linuxstar ~]# userdel -r linuxstar
Forcibly delete users:
[root@linuxstar ~]# userdel -f linuxstar