Linux delete user command

To delete a user on a Linux system, you can use the userdel command.

Here’s the basic syntax for using the userdel command:

userdel <username>

For example, if you want to delete the user john, you would run the following command:

sudo userdel john

Note that by default, the userdel command only removes the user account information, not the user’s home directory or any files belonging to the user. If you also want to remove the user’s home directory, you can use the -r (or --remove) option:

sudo userdel -r john

Be cautious when using this option, as it will permanently delete all files and directories belonging to the user, including any configurations, documents, and other important data.

Leave a Comment