How can I remove a linux user account from linux system. As you know user management in linux requires root privileges. While removing user his home directory can be remove or preserved. As same with mail box. User mailbox can be preserved.
Remove Only User
We will remove user test.
- userdel will remove specified test user account
Check Account Existence
We will check if specified account exists.
$chage -l test
chage: user 'test' does not exist in /etc/passwd
- chage will give information about specified user
- -l test will list users information
- As said before the user is removed so there is no information about the user.
We will remove only user without removing user files.