How to delete user on RHEL 8 / CentOS 8 Linux

Andy

Administrator
Creative Team
User ID
1
Joined
7 Jan 2019
Messages
1,134
Reaction score
57
Points
48
Deleting user on RHEL 8 / CentOS 8 Linux system can be accomplished using the userdel command.

In this tutorial you will learn:
  • How to delete user on RHEL 8 / CentOS 8.
  • How to force user deletion.
  • How to delete the user as well as its home directory.
And here are the steps:
  1. Take a note of the user and its username you wish to remove.

    You can list all system users by using the below cat command:
    Bash:
    cat /etc/passwd

  2. Use the userdel command to remove a user. In this example, we will remove a user with username topimerah. Please note the -r option instructs the userdel command to remove also user's home directory:
    Bash:
    userdel -r topimerah

  3. Optionally, use the -f option to force the user removal in case the user is logged:
    Bash:
    userdel -f -r topimerah
If you have any questions, feel free to post them down below 👇
 
 Short URL:
Back
Top