Users

The userdel command

Deletes a user account. With -r it also deletes their home folder.

Syntax

sudo userdel [-r] <usuario>

Most useful options

-rAlso deletes their home folder

Copy-ready examples

$ sudo useradd ayudante && sudo userdel ayudanteDelete the account
$ sudo useradd temporal && sudo userdel -r temporalAccount and folder

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • Without -r the home folder is left orphaned on the system.

Related commands

FAQ

Can it be undone?

There is no undo button: you have to recreate it by hand.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course