How To Delete User In Linux

Whether you are a system administrator or just a regular Linux user, there is a very high chance that you need to manage users on Linux. However, even if you are a beginner, tweaking different aspects, including deleting a user, is not a hard task at all. In this blog post, we will walk you through how to delete a user in Linux.

Step 1: Use the userdel command

The primary and most widely used command for deleting a user in Linux is the userdel command. It is straightforward to use on its own or with an option.

userdel username

In the above, ‘username’ should be replaced with the name of the user you want to remove.

Step 2: Delete user’s home directory

By default, the userdel command will not remove the user’s home directory. If you want to delete the user along with their home directory, use the -r (or –remove) option:

userdel -r username

Again, ‘username’ should be replaced with the name of the user you wish to delete.

Step 3: Be careful

It is important to note that using the -r option will remove the user’s home directory and its contents, but not the files located in other file systems. You will have to manually locate and delete those files if necessary.

Step 4: Confirm deletion

To check if a user has been deleted, you can use the id command followed by the username:

id username

If the system responds with “no such user,” then the user has been removed successfully.


Managing users, including deleting them, is a basic part of managing a Linux system. The process is simple and straightforward. However, always make sure to double-check your commands before executing, especially when deleting files or users!