Terminal command for GUI command "Remove to trash"
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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.
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.