LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-19-2023, 06:34 PM   #1
sofasurfer
Member
 
Registered: Oct 2003
Posts: 252

Rep: Reputation: 20
Whats proper way to delete /root/.local/share/Trash


I searched for how to delete my root trash and it is a lot more confusing than I would expect it to be. I ended up deleting the entire Trash directory by mistake. I then read that next time I delete something as root user the directory would reappear. It did not. Sooo, do I simply do
Code:
mkdir /root/.local/share/Trash
Then what is the proper way to delete my root trash? I am full up from all the stuff in trash. Even though I deleted the root trash I still have no space left in my root partition.

Last edited by sofasurfer; 01-19-2023 at 06:36 PM.
 
Old 01-19-2023, 06:57 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
That dir would be just the files your deleted manually, like a normal user, which would usually be very few.

Please run the following cmds
Code:
df -h

lsblk
If this is a stock default home install, it's quite likely that the root partition ( '/') also contains /var/log where the logfiles are .
This is likely but not definitively where your space has gone.
The above cmds will help us find out...
 
Old 01-19-2023, 07:55 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,727

Rep: Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919
Are you using a command line trash tool or actually logging in to a desktop as root? Since typically root does not use the desktop with most distributions now days there isn't a Trash directory. With a regular user it depends on the desktop version but either there is a trash icon or you can delete trash from the file browser.

There is the trash-cli tool that uses the same trash environment as the desktops but has its own commands to delete, restore etc.

There are lots of reason the root partition is full besides a lot of trash.
 
Old 01-20-2023, 02:08 AM   #4
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,804

Rep: Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203
Yes, the mkdir should work.
The following command will empty it but might confuse the desktop (file manager).
Code:
find /root/.local/share/Trash/ -mindepth 1 -maxdepth 1 -exec /bin/rm -rf {} +
Better use a command that is provided by the desktop package. For Gnome it is
Code:
trash-empty
 
Old 01-20-2023, 02:15 AM   #5
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,804

Rep: Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203
Perhaps you have deleted files that are still in use?
Check with
Code:
lsof | grep "(deleted)"
Kill or restart the accessing processes, and the data will be freed. (Or reboot.)
 
Old 01-20-2023, 04:00 AM   #6
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,818
Blog Entries: 1

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
I've never had a /root/.local/share/Trash/ directory. I can't imagine a legitimate admin user having need for one. Delete should mean delete, not relocate junk to some other directory, when maintaining a system, especially when there is a space problem on /. A file manager should be selected on its ability to facilitate deleting what needs deleting.

To locate wasted space, try using ncdu. Once you know where the culprits are, try using mc to free the space they waste.

The place to start looking may be the cache your package manager uses in /var/. You might have more space consumed there than anywhere else, if it hasn't been managed and the system has been in use more than a year or two's worth of updating. Another place to look, if it exists, is /var/log/journal/'s subdirectory(s). Anything there more than several weeks or maybe a few months old you'll probably never have a use for. Equally useless, though not such a big waster, are .xz files in /var/log/. Odds are you'll never need those either after a few weeks of age, if ever.
 
Old 01-20-2023, 04:19 PM   #7
sofasurfer
Member
 
Registered: Oct 2003
Posts: 252

Original Poster
Rep: Reputation: 20
I am using Ubuntu 20.04 with Gnome desktop. Thanks for your replies. Let me be clear, I am referring to /root/.local/share/Trash
It does exist. My / directory was full. I looked at my local (user) trash on the desktop and noticed that a bunch of iso files that I had deleted were not in there. I has previously had them in the / directory and then deleted them. So I searched for "trash" and located the /root/.local/share/Trash directory. There I found the iso files. Here is the ls output (I am currently finding this lost info on my clone backup)...
Code:
$ sudo ls -a /root/.local/share/Trash/files
.					 foxclone_std-50-06.iso
..					 systemrescue-9.05-amd64.iso
AAAAAfoxclone44-05.iso			 systemrescue.iso
Afoxclone44-05.iso			 testdebian-live.2.iso
debian-live-11.2.5.0-amd64-cinnamon.iso  testdebian-live.3.iso
debian-live-11.5.0-amd64-cinnamon.iso	 testdebian-live.iso
foxclone_edge50-07.iso
So I deleted the /root/.local/share/Trash directory thinking that when I delete something from / again the directory will be recreated...It was not.

So first I would like you guys to acknowledge that the /root trash directory exists and then tell me what I should have done properly to empty it. Why was a new Trash directory not created when I deleted more stuff from / directory?

MADEINGERMANY...Are you saying that $ trash-empty will empty local trash AND /root trash?

P.S. I have regained my lost space after all. I was mistaken to think I did not. But the above questions still are relevant.

Last edited by sofasurfer; 01-20-2023 at 04:35 PM.
 
Old 01-20-2023, 05:23 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,727

Rep: Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919
Normally Trash does not exist for root but if you used the file manager or other GUI app to move files to trash as root via su or sudo -i then yes the root trash directory will be created. In the same manner you can delete the root's trash. trash-cli consists of trash-empty, trash-put, trash-rm, trash-restore and trash-list utilities which uses the same trash directory as the desktop. I don't know if it will create Trash if it doesn't exist.

If you delete files using the file browser as your regular user then they will go in the user's Trash directory and you can delete them from the trash can using the file browser when you select trash or you can can just delete the directories in the Trash directory from the cli.

Using rm does not put files in trash unless you have some alias that runs as a replacement.

Last edited by michaelk; 01-21-2023 at 01:26 PM.
 
Old 01-21-2023, 01:10 AM   #9
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,804

Rep: Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203
trash-empty will empty the user's trash i.e. $HOME/.local/share/Trash
If called as root then $HOME is /root
 
Old 01-21-2023, 03:13 PM   #10
sofasurfer
Member
 
Registered: Oct 2003
Posts: 252

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by michaelk View Post
If you delete files using the file browser
Yes, my process was to do <$ sudo nautilus> and use the context menu to delete the files. So now I know. Thanks. Marked as solved.
 
Old 01-21-2023, 03:15 PM   #11
sofasurfer
Member
 
Registered: Oct 2003
Posts: 252

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by MadeInGermany View Post
trash-empty will empty the user's trash i.e. $HOME/.local/share/Trash
If called as root then $HOME is /root
I have now installed <trash-cli> and will learn to use it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trash is Full. Empty Trash before moving more files/folders to Trash. wdarledge Slackware 45 12-13-2017 03:53 PM
Trash icon and .local/share/trash not the same bmcgonag Linux - Desktop 2 12-26-2013 10:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration