-   Linux - General (
-   -   Terminal command for GUI command "Remove to trash" (

GunSkit 06-10-2004 04:45 PM

Terminal command for GUI command "Remove to trash"
I'm new to linux and I've found that in the GUI interface, the command "Remove to Trash" (in Fedora Core 2) places the file in the directory /root/trash (or whatever). However, in the terminal when I go to the trash directory, command ls (list) shows no files, and ll command also shows none. However, the GUI interface still shows the file existing in the trash directory (visual). It can be moved, manipulated, etc, but not in the terminal form.

Assuming that the GUI trash folder can be opened and the files restored back onto Desktop in this instance, then in the terminal, what are the commands to do this? (this being, restore. If the terminal doesn't show the files in the trash directory, basically, how can I get them to show, and be able to move back onto an area using the cp comand.)

Why is it that the file exists in GUI, but not in the terminal interface? If it's something along the lines of "Gui recognizes that the file was removed at a point", then what file or command tells the GUI interface that the file currently exists in trash and can be restored when moved? Can this command or file be accessed in terminal ( I would assume so, I'm just ignorant to the process).

One more thing, deleting a file in the terminal, command rm, removes it entirely. What is the equal alternative to it in GUI interface, so that the file is removed completely, not just "Removed to trash", stored in a trash directory, and still taking up space.

thanks, much appreciated.

Andrew Benton 06-10-2004 06:51 PM

cd ~/.Trash
mv * ~/Desktop

To add the delete command to the right click menu open nautilus and click Edit> Preferences> Behaviour> Trash> Include a Delete command that bypasses Trash

subaruwrx 06-23-2004 02:01 AM


Originally posted by Andrew Benton
cd ~/.Trash

I got a message saying no such file or directory?

gtanghookup 06-29-2004 01:50 PM

Hi, the trash in KDE 3.1 is located at ~/Desktop/Trash ( '~' = meta-character (special character) which gives your shell the location of your home directory). I don't know about any other versions of KDE, Gnome or any other window managers though, so what you might try is typing the command:

find ~/ -name *[Tt]rash*

The above command will look for any file or directory that contains the word 'trash' or 'Trash', and display their location. You could then 'cd' into the locations to see if they contain the files that are in your trash can. If the files in your trash can through your GUI are there, then there you have it, your trash can location.

As for the rm command, I don't believe there is such a thing as a command-line command which doesn't destroy the record of a file off the hardrive. Once you delete a file it's gone, though I've heard you can recover it through a more knowledgeable process which I am not too familiar with. Each directory has a list of inodes, which point to files, the inode #'s are looked up in an inode table and the hardrive address is found through this inode table, when a file is deleted (using rm for example), the inode entry in that directory is deleted and the space is marked as free (I believe)... so to recover a file that is lost somehow you can find the hardrive address that contained the blocks of memory you deleted, and if the memory has not been overwritten by some other data, you can access your old data (the deleted file wasn't deleted, it was marked as free). However this is no "trash-can" because it's completely inconsistent and I believe completely un-documented. So anyhousels, I'm pretty sure that by default no shell comes with any command that will store the deleted files in a "trash-can", but there may be a command you can download that would do just that, or if you know scripting or programming at all, it wouldn't be hard at all to make your own command that saves the file in another place before marking the space free.

All times are GMT -5. The time now is 12:11 PM.