LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 12-17-2007, 11:53 AM   #1
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu Lucid Lynx 10.04
Posts: 166
Blog Entries: 1

Rep: Reputation: 15
Can't empty the trash.


There is a file (or files) in the trash that I can't remove. Here is the text of the message I get every time I try to empty the trash:

Error while deleting.
"/home/rich/.../gspca.mod" cannot be deleted because
you do not have permission to modify its parent folder.

I've tried to find this file, to change owner of it. But can't find it.
I'm using Ubuntu on a Dell lappy.

Thanks,
Rich
 
Old 12-17-2007, 12:13 PM   #2
camorri
Senior Member
 
Registered: Nov 2002
Location: Toronto Canada
Distribution: Slackware 14.0 + 14.1
Posts: 4,783

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
If the message is correct, it is the permission or owner of the parent folder(s) that are the problem.

Open a konsole, it will open in your /home/rich directory. You can show directory ownership and permissions with the command 'ls -dl /home/rich' Don't use the quotes, and add what ever the path you need to know about to the above. The standard place to find the trash in in the folder called desktop. It is possible to move it, so you may have to look for it.

Ownership is changed with the command chown and permissions are altered with chmod. If you are running KDE, you can open Konqueror with the house icon on the desktop. By right clicking on the icon, you will get a pop up window, there is a Properties option. Click it, and you will get a tabbed set of properties. There is a tab for permissions and it show the owner. I think if you are not the owner, you have to change at the command line.

Hope this helps.
 
Old 12-17-2007, 12:15 PM   #3
PB0711
Member
 
Registered: Aug 2004
Location: London, UK
Distribution: Ubuntu 10.10, ubuntu 11.04, suse 9.2, OSX
Posts: 259

Rep: Reputation: 30
So what probably happen is that you 'su'-ed while in your home directory or some else with more privileges than you deleted the parent folder. Now you won't see the folder in your home directory because it's in the recycle bin. I would have thought this would have gone to the root user's bin but maybe someone can enlighten me on why not.

What you need to do is empty the recycle bin as root in your GUI space.

Hope it helps
 
Old 12-17-2007, 11:50 PM   #4
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu Lucid Lynx 10.04
Posts: 166
Blog Entries: 1

Original Poster
Rep: Reputation: 15
to cliff

I understand most of the first paragraph, but not this part
"and add what ever the path you need to know about to the above"

I typed the ls -dl /home/rich and get this:
drwxr-xr-x 60 rich rich 4096 2007-12-17 22:45 /home/rich

I don't understand what to do. I do know how to change owners with chown, I've done this. But I don't understand how to find this file or folder.

Thank you
Rich
 
Old 12-17-2007, 11:52 PM   #5
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu Lucid Lynx 10.04
Posts: 166
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Yes, I su-ed following an ubuntu helper's instructions

"What you need to do is empty the recycle bin as root in your GUI space."

How do I do this?
 
Old 12-18-2007, 10:22 AM   #6
camorri
Senior Member
 
Registered: Nov 2002
Location: Toronto Canada
Distribution: Slackware 14.0 + 14.1
Posts: 4,783

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
The full path is the directories to the file in question. All paths in linux start from the root designated as / so your home directory is /home/rich where home is a folder on the root, and rich is a folder in home. The further in you go the directories are separated by the / character.

Quote:
I typed the ls -dl /home/rich and get this:
drwxr-xr-x 60 rich rich 4096 2007-12-17 22:45 /home/rich
This output, note the d at the beginning. This says it is a directory. The rwx is the permissions for rich, you can read write and execute anything in your home directory. Note, rich is the owner, and the group for this directory. Others can only read and execute the files.

To find any file from the command prompt, known as konsole in KDE, you can use the find command, or you can use the loacte command. I prefer locate because it is much faster than find. Open a konsole and swith to root using the 'su' command ( no quotes). Give the root password. Then run the command 'updatedb' without the quotes. That will build a database on your system of all files. It will take a few minutes to complete. You will see lots of disk activity. Once done type as a regular user 'locate thenameofthefileyou wanttofind' No quotes. The file name does not need to be complete, if you are not sure of the spelling. Case does matter, so be careful there.

Post any questions you still have.
 
Old 12-18-2007, 01:16 PM   #7
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu Lucid Lynx 10.04
Posts: 166
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Getting Closer

Here is the result:

rich@rich-laptop:~$ sudo updatedb
Password:
rich@rich-laptop:~$ locate gspca.mod
/home/rich/.Trash/...gspca.mod
/home/rich/.Trash/...gspca.mod/.tmp_versions
/home/rich/.Trash/...gspca.mod/.tmp_versions/gspca.mod
rich@rich-laptop:~$

It still just tells me that the file is in the trash. I appreciate this, and write down all the commands I use in a notebook, and what I did with those commands. You just now showed me a valuable tool of how to find any file.

What should I do next to get rid of these files.

Thank you,
Rich
 
Old 12-19-2007, 09:48 AM   #8
camorri
Senior Member
 
Registered: Nov 2002
Location: Toronto Canada
Distribution: Slackware 14.0 + 14.1
Posts: 4,783

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Quote:
What should I do next to get rid of these files.
To delete any file, it is easiest to change to the directory where the file is. So from a command prompt, say from your home directory, do a 'cd .trash' without the quotes. That should put you in the hidden directory trash. Notice the period before trash. That makes the file system treat the directory as hidden. Continue that until you are in the directory where the file is.

To delete the file run the command 'rm filetobedeleted' without the quotes and spell the file name including case correctly. If you have permission, the system will ask you are you sure, respond with a 'y'. The file should be gone. If you don't have permission, do a 'ls -l filetobedeleted' ( no quotes ) and see who owns it. If it is root, run the command suing 'sudo rm filetobedeleted'

Mow isn't all this typing fun? If you start to type a looooog file name, press the tab key. If what you have typed is unique to all things in the directory you are in, then the system will complete the looooog file name. Try it, it saves your finger tips...

Of course you cad delete any file you have permission for from any directry. You do that by preceding the file name to be deleted with the path to the file.

Another slick thing, learn to use cut and paste in the command line. Run the locate command. When you see the file you want top blow away, highlight it with the mouse pointer, copy and paste that at the command line, after you the the 'rm' command. Press enter, and you will discover you don't need to type out that long string.

Hope this helps.
 
Old 12-19-2007, 12:38 PM   #9
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu Lucid Lynx 10.04
Posts: 166
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Still Puzzled

Here is the result:

rich@rich-laptop:~$ cd .Trash
rich@rich-laptop:~/.Trash$ rm gspca.mod
rm: cannot remove `gspca.mod': No such file or directory
rich@rich-laptop:~/.Trash$

And the same error message appears when I try to empty the trash.
Is it the ellipses (,,,) that precede the filename?
" /...gspca.mod "

The locate command shows the files in .Trash. But the rm command does not.

Hmmm...
 
Old 12-19-2007, 12:53 PM   #10
V!NCENT
Member
 
Registered: Dec 2005
Location: The Netherlands
Distribution: Kubuntu 8.10 KDE4
Posts: 208

Rep: Reputation: 30
What you need to do is search for the folder where that file is in. Write the complete pathname down and put it here on LinuxQuestions.

Now type in the console:
Quote:
cd insert your just written down pathname here
cd stands for 'Change Directory'.
Then type:
Quote:
ls -a
ls stands for 'List'. -a is a option for ls that shows hidden files and folders as well. Now you have a list of files and the file you want to delete should be there too. Now type:
Quote:
sudo rm insert the file you want to delete here
sudo gives you operator rights for everything you type in next to sudo. rm stands for 'ReMove'.
 
Old 12-19-2007, 01:01 PM   #11
camorri
Senior Member
 
Registered: Nov 2002
Location: Toronto Canada
Distribution: Slackware 14.0 + 14.1
Posts: 4,783

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Quote:
And the same error message appears when I try to empty the trash.
Is it the ellipses (,,,) that precede the filename?
" /...gspca.mod "
VINCENT is correct, you are not in the directory where the files are. The string to commas indicate there are more directories. Try my cut and paste method. Do the locate, type cd and then paste the path from the locate command and press enter. That should get you to the correct directory.

Then the only obstacle will be the permission and file owner.
 
Old 12-19-2007, 06:41 PM   #12
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu Lucid Lynx 10.04
Posts: 166
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Regrets

I am embarrassed, and I apologize for being so ignorant. But I really do not understand what you are telling me. I've read the last 2 posts several times, but I can't understand what to do.

I don't know the whole path name for the file name because it is "..." I don't know what it is. But the locate command did tell me it's in .Trash.

And I apologize, but I don't understand what you're telling me with the cut and paste method.

It's not critical that I remove this file from the trash. If it's too much of a hassle to help me further, I will understand. And I thank you for what you've taught me already.

Rich
 
Old 12-19-2007, 07:23 PM   #13
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,812

Rep: Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923
I don't use the GUI tools much, certainly not the trash can.
Just did a test on my Gnome desktop (not Ubuntu, but should be similar). .Trash is empty except for the expected "dot" and "dot-dot". Delete something from the GUI, it appears under .Trash, and the handy-dandy icon gets some crumpled paper. Cute...
Delete the file (from .Trash) from a terminal, and the icon reverts to "empty".

Sooo ... given that @MooseMagnet is just trying to empty the trash, if it were me I'd just do this from a terminal
Code:
 sudo rm -rf .Trash/*
 
Old 12-19-2007, 10:29 PM   #14
MooseMagnet
Member
 
Registered: Oct 2007
Location: U.S.
Distribution: Ubuntu Lucid Lynx 10.04
Posts: 166
Blog Entries: 1

Original Poster
Rep: Reputation: 15
The permissions problem

There is at least one file in my .Trash, for which I do not have permission to delete it.

I can't know it's full path name because of the "..."

If I knew it's full path name, I could locate it and rm it.

The "..." in the path name conceals the full path name.
 
Old 12-20-2007, 03:44 AM   #15
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,372

Rep: Reputation: 1911Reputation: 1911Reputation: 1911Reputation: 1911Reputation: 1911Reputation: 1911Reputation: 1911Reputation: 1911Reputation: 1911Reputation: 1911Reputation: 1911
If your only concern is to empty the trash - as pointed by syg00 - why not change owner of all the trash content and then delete it? E.g. something like this
Code:
sudo chown -R rich:rich /home/rich/.Trash/* && rm -rf /home/rich/.Trash/*
Note: beware of the rm -rf command with asterisks: type them correctly, otherwise your home directory can be hardly damaged!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Move to trash works beautifully, but empty trash .. different story. kd5eax Mandriva 2 12-04-2007 02:52 PM
Unable to empty trash walden Linux - Software 8 04-04-2007 04:29 PM
Evolution won't empty trash jjonas Linux - Software 0 08-12-2006 05:44 AM
trying to empty trash jasonmcneil0 Linux - Software 4 10-26-2003 03:03 AM
empty trash Moleman Linux - Software 1 05-16-2003 12:23 PM


All times are GMT -5. The time now is 02:42 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration