Linux userdel command parameters and usage detailed

Source: Internet
Author: User

Command: Userdel

Function Description: Delete user account.

Syntax: Userdel [-r][user Account]

Supplemental Note: Userdel can delete the user account and related files. If you do not add a parameter, only the user account is deleted without deleting the associated file.


-F Deletes the user login directory and all files in the directory.

Userdel is very simple, only one parameter optional-r; If the parameter-R indicates that the user's home directory and the local mail store directory or file are also deleted together with the deletion of the user; For example, we now have a user jb51, whose home directory is located in the/var directory, now we delete this user;

Userdel jb51 Note: Delete user jb51, but do not delete its home directory and files;

Userdel-r jb51 Note: Delete user jb51, its home directory and file deleted together;

Warning: Please do not use the-R parameter easily, he will delete users at the same time delete all the files and directories, remember; If the user directory has important files, please back up before deleting;

In fact, there is the simplest way, but this approach is a bit unsafe, that is, directly in the/etc/passwd delete you want to delete the user's record; but it is best not to do so,/etc/passwd is a very important document, you may accidentally operate a mistake;

The similar command Groupdel is used to delete the user group;

Syntax format: Groupdel user Group

Groupdel Admin

If you forget to delete the R parameter after you want to delete this user's file can use the following command

Find/--nouser-exec RM-RF {}

Delete all files that are left behind by all users (because the user has been deleted, the owner of their files is their uid, and the parameter nouser is used to delete such files)

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.