Can't Delete Downloaded Files

Credits
891
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
Credits
7,827
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
 
Credits
891
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

Condobloke

Well-Known Member
Credits
7,827
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
Credits
8,488
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

Super Moderator
Staff member
Gold Supporter
Credits
11,451
Bob, what Distro version and desktop environment are you using?

Cheers

Wizard
 

f33dm3bits

Gold Member
Gold Supporter
Credits
12,612
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

Active Member
Credits
2,066
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
Credits
3,089
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.
 
Credits
891
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

Well-Known Member
Credits
7,855
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.
 
Credits
891
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

Well-Known Member
Credits
7,855
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:
Credits
891
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!
 
Credits
891
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
 

Members online


Top