How to remove user from Linux using userdel command
The command used for removing a user from a Linux machine is userdel and the simple syntax for userdel command is userdel <username>. If no command line options are used, the user is deleted and can no longer log into the system. The private user group for the user is also deleted, and the user is removed from any other groups of which he was a member.
The user’s home directory and any other files the user owned are not deleted from the system by default.
To remove the user’s home directory and mail spool, use the userdel -r <username> command. All other files owned by the user must be deleted manually if the administrator needs them removed.