Whether you’re a new user or student learning how to use and manage Linux systems, the easiest place to start might be on Ubuntu Linux OS… Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other devices…
The same way you use your mouse and keyboard to make basic user accounts or perform others simple tasks on Microsoft Windows OS, Ubuntu also makes it that easy for you… If you think using Microsoft Windows is easy, then Ubuntu OS should be a great starting point for you… and also great for beginners…
However, when you’re learning to use and understand Ubuntu Linux, you’ll also want to learn the comnands behind the graphics and mouse-clicking… and how to use them… This tutorial is going to show you how…..
This post shows new users and students what the deluser command is used for and how to use it…
When you’re ready to learn how to use the deluser commands, follow the guide below:
About deluser command:
The deluser command is used by system adminstrators to delete or remove user accounts from Linux systems, including Ubuntu…. a friendly and alternative command is userdel… Like using your mouse and keyboard to delete accounts in the GUI… the deluser is the way to do it on the command line…
By default, the deluser command deletes or removes users without deleting or removing their home directories and mail spools…
The syntax is the rule and format of how the deluser command can be used… the systax’s options can be reordered.. but straight format must be followed.,.
Below is an example syntax of how to use the deluser comamnd….
userdel [options] LOGIN..
The command line options are switches or flags that determined how the commands are executed or controlled… they modify the behavior of the command… they are separated by spaces and followed after the commands options…
Below are some options of the deluser command:
|LOGIN…||Replace LOGIN ….. with the name of the account you want to delete…. If the account doesn’t already exist, the command will fail and not execute…….|
||Use the -f or –force option to force the removal of the user’s files…|
|-r, –remove||Use the -r or –remove option to remove home directory and mail spool…|
|-R, –root CHROOT_DIR||Use the -R or –root CHROOT_DIR option to specify thedirectory to chroot into
|-Z, –selinux-user||Use the -g or –gid GROUP option to remove any SELinux user mapping for the user|
Below are some examples of how to run and use the deluser on Ubuntu Linux…
If you want to delete an account name John, run the commands below…
If you wish to delete or remove John’s account including deleting his home directory, run the commands below…..
deluser --remove-home john
If you’re not logged in as a root account, you may have to use the sudo command it it…
sudo deluser --remove-home john
To you want to delete John’s account even while he’s logged in, run the commands below…
sudo deluser --force john
To delete John’s account and backup his home directory, run the commands below…
sudo deluser --backup-to /backup_directory john
The commands above will delete the user account and create an archive of the user’s home directory into the path you specified…
When you run deluser with the –help option, you’ll see the help text below:
Usage: userdel [options] LOGIN Options: -f, --force force removal of files, even if not owned by user -h, --help display this help message and exit -r, --remove remove home directory and mail spool -R, --root CHROOT_DIR directory to chroot into -Z, --selinux-user remove any SELinux user mapping for the user
Hope you like it and please come back soon for more Ubuntu Linux command!
You may also like the commands below: