All rights reserved, please indicate the source when citing
userdel - Delete User Accounts
The userdel command is used to delete user accounts on a Unix-like operating system. It can only be executed by the superuser (root) as it involves making changes to system user account information.
The basic syntax for the userdel command is as follows:
userdel [OPTIONS] USERNAME 。
Here, "USERNAME" is the name of the user account you want to delete.
Some of the commonly used options for the userdel command include:
- -r : Remove the user's home directory and mail spool in addition to deleting the user account.
- -f : Forcefully delete the user account even if they are currently logged in.
- -l : Only remove the user's login information, keeping the home directory and mail spool intact.
For example, if you're logged in as the root user:
# userdel -r ken ←Deletes the user account "ken" along with their home directory and email spool |
Please exercise caution when using the userdel command, especially with the "-r" option, as it permanently removes user data.
For more details on the userdel command and additional examples, you can refer to the provided link.