DevHeads.net

How to empty trash?

Being a fairly new user to Linux/Ubuntu I did a stupid thing and do not know
how to get out of it. I have a new laptop that I am trying to set up as a
replacement of an old laptop. I copied a my home directory from a desktop that
had an upgrade fail to the new laptop as backup before trying to recover the
desktop. I did not check the amount of space needed and the laptop did not
have enough space so the /home partition ran out of space. I thought no
problem I would just get rid of the data I just copied. Not having much
experience with Ubuntu I just sent the data to trash and then tried to empty
the trash. That does not work as I found out as the system needs disk space to
empty the trash and there is none available. To make things worse now that
/home has no space I get logged off after about 1 1/2 minutes so I have not
been able to do much experimenting in that amount of time.

So how do I empty the trash and get the disk space back?

Comments

Re: How to empty trash?

By Peter Flynn at 05/14/2018 - 17:10

On 14/05/18 19:13, Bob wrote:
Not sure I understand that, but carry on.

The *new* laptop didn't have enough space? That's pretty unusual, I
would think.

Can I see if I have understood this right:

a. you copied your home directory from the old laptop to the new one
(but where did you put it, ie what directory did you copy it to?)

b. you then copied it all over again, this time to /home/bob or
whatever, and it ran out of space while doing this.

What data did you send to the Trash? The original copy (a) or the failed
copy (b)?

The problem with Trash is that it's misleading (on all systems). It's
just a directory, so it takes up exactly the same amount of space as
what you move into it, resulting in zero saving of disk space (actually
slightly worse, because on some systems it also stores the directory
that each file came *from* so they could be restored).

Find out where it is, and then do as Liam suggested, eg:

cd /home/bob/Trash
rm -rf *

The rm command deleted files immediately and there is NO RECOVERY. It's
dangerous if you are not 100% certain that these are the files you want
to delete, but for many people it's the normal way of working. The -r
option makes it recurse into subdirectories, and the -f option means
"force", ie just do it and don't ask questions.

///Peter

Re: How to empty trash?

By silver.bullet at 05/15/2018 - 01:07

On Mon, 14 May 2018 23:10:30 +0100, Peter Flynn wrote:
Most likely it's either $HOME/.local/share/Trash/ or it's a hidden file
on top of a partition's directory named .Trash-$UID .

Re: How to empty trash?

By Bob at 05/15/2018 - 12:29

** Reply to message from Ralf Mardorf <silver. ... at zoho dot com> on Tue, 15 May
2018 08:07:16 +0200

Thanks to all that replied.

I deleted the files in ~/.local/share/Trash/files, there were many files that
were not deleted because of permissions but enough was deleted to now do other
things.

Again thanks to all.

Re: How to empty trash?

By MR ZenWiz at 05/15/2018 - 01:22

On Mon, May 14, 2018 at 11:09 PM Ralf Mardorf <silver. ... at zoho dot com>
wrote:

IIRC (and it has been a while since I looked), the trash directory is
something like .Trash or ._Trash in the user's home directory.

Do 'ls -a' and see what it shows.

MR

Re: How to empty trash?

By Dr Rainer Woitok at 05/15/2018 - 04:02

Greetings,

Running on Xubuntu 16.04 and having never yet used the trash directory I
just moved a file to trash, searched it in my home using "find" and was
thus guided to the two directories "~/.local/share/Trash/files/" and
"~/.local/share/Trash/info/".
Hope that helps.

Sincerely,
Rainer

Re: How to empty trash?

By Liam Proven at 05/14/2018 - 16:38

Well, there are several possible ways.

Firstly: do you have another copy of your backed-up stuff?

Secondly: is there a subset of the stuff you transferred you could delete
to save some space without losing everything? E.g. just the downloads
folder.

Options:

* boot off the live DVD/USB you used to install the laptop. Pick "try
Ubuntu". It will load to the desktop and you can use that to browse through
the files on the hard disk and selectively delete stuff.

* How big is the laptop HD? Is it totally full? If not, GParted (on the
live DVD/USB) might let you shrink your root partition and expand /home a
bit -- or if you don't have a separate /home, expand the Ubuntu partition a
bit.

Neither of those work?

* Command line way -- works but a high risk of disaster.

Where did you put the stuff you copied? Is it all in a single subdirectory
of your home folder?

E.g. if your user account was called bobb, it might be in
/home/bobb/transfer/.

You could boot the machine, but *not log in*.

When it's at the login screen, press Ctrl-Alt-F1.

You can log in there. Same username and password.

Then type:

cd /home/bobb

(or whatever your username is)

That puts you in your home directory.

Type:

cd transfer

To move into the directory of stuff you transferred.

Make sure the prompt now says:

bobb@laptop:~/transfer

or whatever username@computername:~/yourfolder is.

(If you didn't put it all in 1 folder, if it's in Documents and Pictures
and Music and so on, do them one by one.)

Then if you wanted to get rid of everything, type, very carefully so you
make no mistake:

rm -rf *

If you can just delete 1 big file, that'll give you room to empty the bin...

e.g.

login
cd /home/bobb
cd transfer
rm windows10.iso