Usage of Linux userdel command

Usage of Linux userdel command

1. Command Introduction

The userdel (user delete) command is a system administrator command used to delete user accounts and related files.

In fact, the userdel command actually modifies the system's user account files /etc/passwd, /etc/shadow, and /etc/group files, which is consistent with the Linux system's idea of ​​"all operations are files."

It is worth noting that the userdel command will not usually delete a user account if there are processes related to the user to be deleted running. If you really need to delete it, you can terminate the user process first, and then execute the userdel command to delete it. But the userdel command also provides a parameter to deal with this situation, namely the -f option.

2. Command format

userdel [options] LOGIN

If no options are given, only the user account will be deleted without deleting the associated files.

3. Option Description

-f, --force
		Force delete user, even if the user is currently logged in -h, --help
	Display help information and launch -r, --remove
	When deleting a user, delete all files related to the user, such as deleting the home directory and mail pool -R, --root CHROOT_DIR
 	Apply changes in CHROOT_DIR directory and use the configuration file in CHROOT_DIR directory -Z, --selinux-user
	Remove all SELinux user mappings for a user

4. Common Examples

(1) Delete the user, but do not delete his home directory and files.

userdel tom

(2) Delete the user, home directory and mail pool.

userdel -r tom

Please do not use the -r option lightly, as it will delete all the user's files and directories when deleting the user. If there are important files in the user directory, please back them up before deleting.

(3) Force deletion of users.

userdel -f tom

The above is the detailed content of the use of linux userdel command. For more information about linux userdel command, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Use of Linux gzip command
  • Use of Linux date command
  • How to run Linux commands in the background
  • Use of Linux stat command
  • Use of Linux ls command
  • Use of Linux ln command
  • Linux cut command explained
  • Use of Linux bzip2 command

<<:  Let's talk about parameters in MySQL

>>:  About the problems of congruence and inequality, equality and inequality in JS

Recommend

Detailed explanation of CocosCreator optimization DrawCall

Table of contents Preface What is DrawCall How do...

Summary of Textarea line break issues in HTML

Recently, I encountered a problem of whether the d...

Key features of InnoDB - insert cache, write twice, adaptive hash index details

The key features of the InnoDB storage engine inc...

JavaScript function encapsulates random color verification code (complete code)

An n-digit verification code consisting of number...

Tutorial on installing MySQL 5.7.18 using RPM package

system: CentOS 7 RPM packages: mysql-community-cl...

mysql having usage analysis

Usage of having The having clause allows us to fi...

JavaScript to achieve uniform animation effect

This article example shares the specific code for...

Detailed analysis of MySQL master-slave replication

Preface: In MySQL, the master-slave architecture ...

Introduction to Royal Blue Color Matching for Web Design

Classical color combinations convey power and auth...

Problems with join queries and subqueries in MySQL

Table of contents Basic syntax for multi-table jo...

A brief analysis of the count tracking of a request in nginx

First, let me explain the application method. The...

Storage engine and log description based on MySQL (comprehensive explanation)

1.1 Introduction to storage engines 1.1.1 File sy...

Use elasticsearch to delete index data regularly

1. Sometimes we use ES Due to limited resources o...