Okay, i solved it myself. With help of find / -nouser -o -nogroup 2> /dev/null you see all unlinked/unowned files on your system and you can delete every single file left on your system.
If you didn't use -r option with userdel command, you can do the following to get rid of all old user's files.
- Delete removed user's
home directory. cd /home; rm -r username
- Find remaining files:
find / -nouser -o -nogroup 2> /dev/null.
- Delete every file in the output of previous command.
Important edit: Instead of these 3 steps, use:
find / -nouser -o -nogroup 2> /dev/null | xargs rm -fr
It removes every single output of find command with force (-f) and recursive (-r) options of rm command.
Quote from @Tim Pierce's answer on this question:
xarg reads lines on standard input and turns them into command-line arguments, so you can effectively pipe data to the command line of another program.
Edit #2: According to @roaima, we need to use:
find / \( -nouser -o -nogroup \) -print0 | xargs -0 rm -rf
Good luck!
-nouser -nogroup. How do they work since files are not linked in system? – rzaaeeff Mar 15 '15 at 18:27homedirectory. Thank you. – rzaaeeff Mar 15 '15 at 18:28