Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This 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.


  Search this Thread
Old 06-10-2004, 04:45 PM   #1
LQ Newbie
Registered: Jun 2004
Posts: 3

Rep: Reputation: 0
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.
Old 06-10-2004, 06:51 PM   #2
Andrew Benton
Senior Member
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
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
Old 06-23-2004, 02:01 AM   #3
Registered: Mar 2004
Distribution: Ubuntu Feisty
Posts: 641

Rep: Reputation: 30
Originally posted by Andrew Benton
cd ~/.Trash
I got a message saying no such file or directory?
Old 06-29-2004, 01:50 PM   #4
LQ Newbie
Registered: Sep 2003
Location: Portland, Oregon
Distribution: Debian and Gentoo
Posts: 27

Rep: Reputation: 15

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.


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sound: "play command" terminal gone? eyewittness Linux - Software 6 07-10-2004 08:27 AM
how do i remove unwanted charaters at "script" command output? linuxzouk Linux - Newbie 4 05-15-2004 07:58 AM
Method to "Save" a terminal command avarweth Linux - Software 8 11-12-2003 06:21 AM
Why did Mandrake 9.2 Remove "Run" command? whoots Mandriva 3 10-22-2003 08:46 AM
"segmentation error" when issuing "useradd" command through terminal with RH 9.0 kaihuang Linux - General 0 10-21-2003 11:47 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:51 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration