Linux Mint – Removing user accounts

Initial Configurations of Windows server 2019

Of course, removing a user account in Linux Mint is just as easy as creating one. In the Users and Groups tool, simply click on the Delete button, as shown in the following screenshot:

However, note that doing so will also remove all the files of that user as well as their settings. Using shell commands, you can actually decide to keep the user’s files even after removing their account. The deluser command will allow you to remove a user account via the Linux shell. For example, to delete user jdoe, use the following command line:

sudo deluser jdoe

Although the preceding command would delete the jdoe user, note that it does not delete the user’s home directory. If you execute the following command after deleting the user, you will notice that the home directory for jdoe will still be listed:

ls /home

This is a great thing when used in a corporate environment, since you may be tasked with removing a user account but may have retention policies in place that mandate how long you must keep the files around. If you would like to remove the home directory for the user later, you should execute the following command line:

sudo rm -r /home/jdoe


Although it may go without saying, be very cautious with the rm -r command, especially when deleting files in the /home folder or in the root of your filesystem. For example, if you were to execute sudo rm -r /home without specifying a user folder, you would make every user on the system or server extremely unhappy with you. Similarly, if you execute sudo rm -r /, there’s a possibility that your system would need to be redone.

Comments are closed.