How can Ubuntu delete a user and directory?

To delete a user and their directory in Ubuntu, you can follow these steps:

  1. Log into the system with superuser’s permission (root).
  2. Use the following command to delete a user and their directory (replace “username” with the username to be deleted):
sudo userdel -r username

The -r option indicates that when deleting a user, their home directory will also be deleted.

  1. The system will prompt you to enter a password to confirm the deletion operation.

Please note that this action is irreversible, once deleted, users and their directories cannot be recovered, so please proceed with caution.

bannerAds