How to Delete a User in Linux

Photo of author

By Oluwaseun Bamisile

Published

Do you wish to delete a user account on your Linux computer but need help with that? You have come to the right place, as this guide demonstrates various methods to achieve that.

Option 1: Delete a User Through the GUI

The majority of the Linux operating systems offer a graphical user interface. Therefore, if you use a Linux OS with a GUI, you can remove a user account from your computer through the GUI.

To do that, follow the procedures below. However, before proceeding, you need to know that the following procedures are performed on the Ubuntu 22.04 LTS Linux-based operating system.

Hence, the procedures may be slightly different from other versions of the Linux operating system.

  1. On the taskbar, left-click the Show applications button. Next, type “settings” in the search field, then select Settings from the search result.
  1. Afterward, select Users on the left pane of the Settings window.
Delete A User In Linux Through The GUI
  1. Following that, click the Unlock… button opposite Unlock to Add Users and Change Settings at the top of the right pane.
  1. Subsequently, input your password in the prompt that appears, then click the Authenticate button.
Delete A User In Linux Through The GUI
  1. After doing that, select the user account you wish to delete from your Linux computer. For this demonstration, I will be deleting the “seun” user account from my Linux PC.
  1. Then, at the bottom of the page, select the red Remove User… button.
Delete A User In Linux Through The GUI
  1. Finally, you will receive a prompt asking if you want to keep the files of the user account. If you wish to keep the files, click the Keep Files option on the prompt.

    However, if you wish to delete the files, click the Delete Files option on the prompt.

Option 2: Delete a User Through the Terminal

Interestingly, you can also remove a user account from your Linux computer through the terminal. To accomplish that, follow the steps and screenshot images below.

  1. On your Linux desktop, right-click any free space and select Open in Terminal. Alternatively, press the Crtl + Alt + T keys simultaneously to open the terminal in Linux.
  1. When the terminal opens on your Linux computer, execute the command below to delete a user account. However, replace “username” with the name of the user account you wish to delete.
sudo deluser username

For this demonstration, I will delete a user account on my Linux computer called “seun.” Therefore, below is what the command should look like.

sudo deluser seun
Delete A User In Linux Through The Terminal
  1. Consequently, you will be prompted to input the password of your Linux computer. Hence, input the password and press the enter key to continue.
Characters won’t be visible when inputting your password.
  1. After doing all that, the user account should be deleted.
Delete A User In Linux Through The Terminal

Frequently Asked Questions

1. Can I remove a user account in Linux through the terminal?

Yes, you can remove a user account in Linux through the terminal. To remove a user account in Linux via the terminal, follow the steps below:

a) On your Linux desktop, right-click any free space and select Open in Terminal.
b) When the terminal opens on your Linux computer, type “sudo deluser username” and press the enter key. However, replace “username” with the name of the user account you wish to remove from your Linux computer.
c) Consequently, you will be asked to input the password of your Linux computer – do that and press the enter key to continue. Hence, the user account should be deleted.

2. Why do hackers use Linux?

Hackers mostly use Linux due to its flexibility, open-source platform, command line interface, and compatibility with popular hacking tools.

3. Can Linux be hacked?

Yes, the Linux operating systems can be hacked. Even though the OS is very secure, hacking a Linux operating system is still possible.

4. Is Linux free?

Yes, the Linux OS is free and open source.

5. When was Linux introduced?

The Linux operating system was introduced on 17 September 1991.

Conclusion

For various reasons, someone might wish to delete a user account on his/her Linux computer. Fortunately, this guide demonstrated multiple ways to accomplish that.

To be more specific, we learned how to perform this task through the settings on the Linux GUI. This guide also taught us how to remove a user account in the Linux operating system via the terminal.

Now that you’ve concluded this Linux guide, I hope you found it helpful. If you did, click on “Yes” beside the “Was this page helpful” question below.

You may also express your thoughts and opinions by using the “Leave a Comment” form at the bottom of this page.

Finally, visit our Linux how-to page to get more Linux guides.

About the Author

Photo of author

Oluwaseun Bamisile

Oluwaseun is the Lead Content Editor at Itechguides.com. He holds a National Diploma in Computer Science (currently studying part-time for his Higher National Diploma). An internet geek with a love for automobiles, he writes product reviews, tech articles, and how-to guides on the site.

Related Articles

Get in Touch

We're committed to writing accurate content that informs and educates. To learn more, read our Content Writing Policy, Content Review Policy, Anti-plagiarism Policy, and About Us.

However, if this content does not meet your expectations, kindly reach out to us through one of the following means:

  1. Respond to "Was this page helpful?" above
  2. Leave a comment with the "Leave a Comment" form below
  3. Email us at [email protected] or via the Contact Us page.

Leave a comment

Send this to a friend