deluser Command Examples in Linux

deluser is a command line tool in Linux that can be used to delete a user account and its related files and directories. It is typically used by system administrators to remove user accounts that are no longer needed.

deluser Command Examples

1. Remove a user:

# deluser username

2. Remove a user and their home directory:

# deluser --remove-home username

3. Remove a user and their home, but backup their files into a `.tar.gz` file in the specified directory:

# deluser --backup-to path/to/backup_directory --remove-home username

4. Remove a user, and all files owned by them:

# deluser --remove-all-files username

5. To delete a user account and its related files and directories:

# deluser --backup --remove-all-files username

6. To delete a user account and its related files and directories and also delete the user’s mail spool:

# deluser --backup --remove-all-files --remove-mail-spool username

Please note that deluser is a command that is used to delete a user account from the system, it’s important to be careful when using this command as it can cause data loss if used improperly. It’s always a good idea to backup the data before removing a user account.

Related Post