• We did not send an email asking for donations - please read this post.

Can't Delete Downloaded Files

SpongebobFan1994

Well-Known Member
Joined
Jan 10, 2021
Messages
740
Reaction score
427
Credits
7,203
I'm trying to get rid of files in my download folder that I no longer want or need, especially since I need to free up space on the hard drive to install Ubuntu MATE, but I somehow no longer have the permission to do so and I don't know how to get it back. I should mention I don't share this computer with anyone (if that helps).
 


Condobloke

Well-Known Member
Joined
Apr 30, 2017
Messages
5,111
Reaction score
4,299
Credits
30,062
Trash is located at $HOME/.local/share/Trash

If you cannot delete it from there, right click on the Trash folder and open it as root.....then delete the contents etc......that should achieve it
 
OP
SpongebobFan1994

SpongebobFan1994

Well-Known Member
Joined
Jan 10, 2021
Messages
740
Reaction score
427
Credits
7,203
Trash is located at $HOME/.local/share/Trash

If you cannot delete it from there, right click on the Trash folder and open it as root.....then delete the contents etc......that should achieve it

Whenever I tried to send something to the trash, I'd get an error message saying it couldn't be moved.

Also, I wasn't able to open the Trash folder as Root, but I did manage to do that to one of the files I was trying to delete. What should I do now?
 

Attachments

  • Screenshot from 2021-01-20 00-23-54.png
    Screenshot from 2021-01-20 00-23-54.png
    15.9 KB · Views: 331
  • Screenshot from 2021-01-20 00-19-35.png
    Screenshot from 2021-01-20 00-19-35.png
    34.8 KB · Views: 331

Condobloke

Well-Known Member
Joined
Apr 30, 2017
Messages
5,111
Reaction score
4,299
Credits
30,062
I think it would be best to wait for someone who knows how to delete the trash via terminal.

I have a vague idea how to do it, but it can be deadly if done incorrectly.

@wizardfromoz

@KGIII

@Lord Boltar

@f33dm3bits

by putting the @ symbol in front of their name, it will let them know to take a look here
 

captain-sensible

Well-Known Member
Joined
Jun 14, 2019
Messages
2,913
Reaction score
1,970
Credits
18,126
my trash is at :
/home/andrew/.local/share/Trash

if i cd to /home/andrew/.local/share/Trash

then ls --color i see sub directories of :
expunged files info

to remove stuff from sub-directory "files" in main trash directory i use:

bash-5.0# rm -r files/*

i.e or for you sudo rm -r files/*

i use the same approach for other directories eg to remove all from "tmp" directory:

# rm -r /tmp/*
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
7,779
Reaction score
6,605
Credits
28,603
Bob, what Distro version and desktop environment are you using?

Cheers

Wizard
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,944
Reaction score
3,589
Credits
36,026
What are the permissions for the file "Jami"? If you create an empty file from the command line, for example:
Code:
touch test.txt
ls -l test.txt
Are you able to delete the "test.txt" file through the filemanager with this newly created file?
 
Last edited:

Lord Boltar

Well-Known Member
Joined
Nov 24, 2020
Messages
1,898
Reaction score
1,304
Credits
14,121
One solution is to first change permissions in the Trash folder
Code:
cd ~/.local/share/Trash
Code:
sudo chown -R your_user_name:your_group *
Then empty it the usual way
The location of the trash in Ubuntu (and other Linux) is .local/share/Trash/ in your home directory. To empty trash, you can delete the contents of this directory.
Open a terminal and use the following command:
Code:
rm -rf ~/.local/share/Trash/*
Be careful in what you type. You are using the remove command. I trust you that you won’t be deleting any other files or directory
 

Vrai

Well-Known Member
Joined
Mar 16, 2019
Messages
1,060
Reaction score
999
Credits
4,055
I'm trying to get rid of files in my download folder that I no longer want or need, especially since I need to free up space on the hard drive to install Ubuntu MATE,
How much (or little) free space is there on that hard drive?
The first screenshot you posted shows "Cannot move file to trash, do you want to delete immediately?
The file "Jami" cannot be moved to trash."

Have you tried selecting "delete immediately" from that dialog box?
Also, what does the "Show more details" show? May be some useful info there.
 
OP
SpongebobFan1994

SpongebobFan1994

Well-Known Member
Joined
Jan 10, 2021
Messages
740
Reaction score
427
Credits
7,203
What are the permissions for the file "Jami"? If you create an empty file from the command line, for example:
Code:
touch test.txt
ls -l test.txt
Are you able to delete the "test.txt" file through the filemanager with this newly created file?

I had just changed the permissions to Create and Delete. I typed those commands into Terminal and I didn't get anything back.
 

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
7,334
Reaction score
6,321
Credits
59,450
Using the rm command from the terminal will bypass the trash entirely (unless you changed that behavior).

So, open the terminal...

Code:
cd Downloads
ls -a
rm <filename>

The first command will move you to the Downloads directory.

The second will list all the files in that directory.

The third will remove the files you want - you can look at them and see their names because you listed them.

Remember, tab should autocomplete for you.

rm goo<tab> will fill in like 'google-chrome-stable.deb' and the likes.
 
OP
SpongebobFan1994

SpongebobFan1994

Well-Known Member
Joined
Jan 10, 2021
Messages
740
Reaction score
427
Credits
7,203
Using the rm command from the terminal will bypass the trash entirely (unless you changed that behavior).

So, open the terminal...

Code:
cd Downloads
ls -a
rm <filename>

The first command will move you to the Downloads directory.

The second will list all the files in that directory.

The third will remove the files you want - you can look at them and see their names because you listed them.

Remember, tab should autocomplete for you.

rm goo<tab> will fill in like 'google-chrome-stable.deb' and the likes.

Is there a way I can remove all files at once?
 

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
7,334
Reaction score
6,321
Credits
59,450
Hmm...

This CAN NOT (easily) be undone. This will delete EVERY file and directory in your Downloads folder.

Open the terminal. Don't bother changing directories. It should open in your home directory.

-----------

EDIT: If you're unsure, the following command should be run from your home directory. You can get there with:

Code:
cd ~/

-----------

Code:
rm -rf Downloads/*

THAT WILL DELETE EVERYTHING IN YOUR "Downloads" FOLDER.

It will NOT put the files into your trash folder. The files will be completely removed. Recovery will be a pain in the arse. Make sure you do not want anything that is in the directory before running that command.

Note the edit - if you're not sure that you're in your home directory, go ahead and run the cd command to make sure you're there. Running the 'rm -rf' command with an asterisk can be pretty risky. You can double-check with 'ls Downloads/' and make sure those are the files you want to delete.
 
Last edited:

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
7,334
Reaction score
6,321
Credits
59,450
Also, a nifty trick that may not apply in this case...

You can just delete your entire trash folder. The OS will recreate it the next time you delete something (unless you just directly delete it). When you next send a file to the trash folder, the system happily recreates it.
 
OP
SpongebobFan1994

SpongebobFan1994

Well-Known Member
Joined
Jan 10, 2021
Messages
740
Reaction score
427
Credits
7,203
Hmm...

This CAN NOT (easily) be undone. This will delete EVERY file and directory in your Downloads folder.

Open the terminal. Don't bother changing directories. It should open in your home directory.

Code:
rm -rf Downloads/*

THAT WILL DELETE EVERYTHING IN YOUR "Downloads" FOLDER.

It will NOT put the files into your trash folder. The files will be completely removed. Recovery will be a pain in the arse. Make sure you do not want anything that is in the directory before running that command.

Everything in my Downloads folder are things I can live without, such as a few Spongebob pictures I've posted on here. Anyway, thanks!
 

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
7,334
Reaction score
6,321
Credits
59,450
Then, by all means, go ahead and run it!

Just 'member that it's a REALLY dangerous command to run and you need to make sure you run it properly.

It can (and will) hose your system if you run the 'rm -rf' command improperly.
 
OP
SpongebobFan1994

SpongebobFan1994

Well-Known Member
Joined
Jan 10, 2021
Messages
740
Reaction score
427
Credits
7,203
Then, by all means, go ahead and run it!

Just 'member that it's a REALLY dangerous command to run and you need to make sure you run it properly.

It can (and will) hose your system if you run the 'rm -rf' command improperly.

I kept getting error messages, saying "permission denied", when running the command
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online

No members online now.

Top