Can't Delete Downloaded Files

SpongebobFan1994

Well-Known Member
Joined
Jan 10, 2021
Messages
858
Reaction score
492
Credits
8,257
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
6,100
Reaction score
5,089
Credits
38,598
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
858
Reaction score
492
Credits
8,257
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: 371
  • Screenshot from 2021-01-20 00-19-35.png
    Screenshot from 2021-01-20 00-19-35.png
    34.8 KB · Views: 385

Condobloke

Well-Known Member
Joined
Apr 30, 2017
Messages
6,100
Reaction score
5,089
Credits
38,598
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,910
Reaction score
1,971
Credits
18,114
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
8,628
Reaction score
7,587
Credits
35,291
Bob, what Distro version and desktop environment are you using?

Cheers

Wizard
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
5,925
Reaction score
4,414
Credits
43,540
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
2,216
Reaction score
1,621
Credits
16,361
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,084
Reaction score
1,044
Credits
4,216
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
858
Reaction score
492
Credits
8,257
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
9,049
Reaction score
7,695
Credits
73,849
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
858
Reaction score
492
Credits
8,257
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
9,049
Reaction score
7,695
Credits
73,849
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
9,049
Reaction score
7,695
Credits
73,849
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
858
Reaction score
492
Credits
8,257
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
9,049
Reaction score
7,695
Credits
73,849
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
858
Reaction score
492
Credits
8,257
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
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Staff online

Members online


Latest posts

Top