In this tip we will learn a simple command that will allow us to remove all files and folders owned by a user under Ubuntu from the command line. So, use this command carefully because it will wipe out all data stored in the home folder of the target user.

To do this, open the terminal and run this command:

find /home/ -user username -exec rm -fr {} \;

Replace username with the username of the user you want to delete his files and folders. If you want to remove the user account along with his home files and folders, you can use this command instead:

deluser --remove-all-files username

That's it!

Post a Comment