To delete a user in Linux, you can use the
userdel command followed by a space and the name for the user to delete in Linux.
For example, let's say you want to delete a user called
john, you can use the
userdel command like this,
# Delete a user in Linux sudo userdel john
- Sometimes you may need to use the
sudocommand before the
userdelcommand to obtain the correct privileges to execute the command.
Try executing the above command in this online terminal to see the result.