Beginners learning Linux will certainly encounter some puzzling problems. For example, when I learn to delete a user, I encounter the above error
1 | userdel: user xiaoming is currently used by process 4713 |
Not only that, it was successful when I created this directory, but if I found this error when I su – Xiaoming
1 | No directory, logging in with HOME=/ |
The solution found in the Linux community can not be solved (maybe my level of data search needs to be improved)
This is the answer of the community. Finally, I found a similar problem on CSDN and solved it
The method is as follows:
My personal guess is that under the root user, Su switches to the Xiaoming user, and then under the Xiaoming user, it switches back to root. However, the Xiaoming user is still occupied by a process, so the process does not die and the user does not del
So we use Ctrl + D in the command line to exit the current login, and then press Ctrl + d once to exit the login of Xiaoming user. At this time, we go back to the root user and use the
1 | userdel -r xiaoming |
You can delete Xiaoming successfully