[linux] How can I delete a user in linux when the system says its currently used in a process

I am trying to delete a user I created on ubuntu.

However when I use the following command:

userdel -r cafe_fixer

I get the following message:

user cafe_fixer is currently used by process 15945

I am not using this user for anything I just created it and now wish to delete it.

Any help appreciated.

This question is related to linux

The answer is


It worked i used userdell --force USERNAME Some times eventhough -f and --force is same -f is not working sometimes After i removed the account i exit back to that removed username which i removed from root then what happened is this

image description here


Only solution that worked for me

$ sudo killall -u username && sudo deluser --remove-home -f username

The killall command is used if multiple processes are used by the user you want to delete.

The -f option forces the removal of the user account, even if the user is still logged in. It also forces deluser to remove the user's home directory and mail spool, even if another user uses the same home directory.

Please confirm that it works in the comments.


restart your computer and run $sudo deluser username... worked for me


pkill  <process id>
userdel <username>