Find the answer to your Linux question:
Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By jayd512
I notice that 'sudo deluser username' doesn't free up diskspace. The disk space is the same after I deleted user as before I did. Essentially how do i return disk ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2012
    Posts
    27

    How do I remove all files of a user after I have already deleted user?


    I notice that 'sudo deluser username' doesn't free up diskspace. The disk space is the same after I deleted user as before I did.

    Essentially how do i return disk to the same available percentage of space as before I added user.

  2. #2
    Administrator jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    5,025
    Removing the username doesn't remove his files or directory.
    You could try:
    Code:
    cd /home
    sudo rm -R <user_name>
    rajesh-linux likes this.
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to private messages asking for Linux help. Please keep it on the public boards.

  3. #3
    Just Joined!
    Join Date
    Mar 2008
    Posts
    25
    Does the user own files outside of the user home directory? If so, you can use the find command to locate their files and pipe that to the rm command. Use this string in Google and check out the first hit:
    using the find command to locate files owned by a user
    I can't post a link because I haven't posted enough replies in this forum yet

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Jul 2008
    Posts
    54
    Quote Originally Posted by papazulu View Post
    I notice that 'sudo deluser username' doesn't free up diskspace. The disk space is the same after I deleted user as before I did.

    Essentially how do i return disk to the same available percentage of space as before I added user.
    Jay's answer above will remove the user's directory, and since most of the files the user created should be in his directory, this will probably be enerything you need.

    BUT if the user created files that are not in his directory, then you need a way to go find them. If the user is no longer in the /etc/password file, you can use the following:
    Code:
    sudo find / -nouser -print
    which will print all files which are not owned by a user in the /etc/passwd file. NOTE: This just finds them, it doesn't delete them. The more dangerous version is:
    Code:
    sudo find / -nouser -exec /bin/rm -f '{}' \;
    which deletes all the files it finds that aren't owned by a user in /etc/passwd.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •