Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 03-14-2005, 10:03 AM   #1
Registered: Mar 2005
Location: Canada
Distribution: Slackware
Posts: 47

Rep: Reputation: 15
Trash?? what does rm do exactly?

Ok.. if I rm ... where does it go?? is gone forever?? or is it in the 'trash' somewhere (sorry if that is only a windows thing) Do I need to "emply" something??

sorry.. i know this is a total noob question

thanks for any help.
Old 03-14-2005, 10:07 AM   #2
Registered: Feb 2005
Location: Denver, CO
Distribution: Slack 12, tweaked just so (though I'm also a fan of Ubuntu)
Posts: 198
Blog Entries: 1

Rep: Reputation: 30
My understanding is that, much like the DEL command in DOS, it deletes all reference to the file from the file allocation table (or Linux equivalent), not just moving the file to a temporary 'trash' location. Once you've rm'ed something, you're done.
Old 03-14-2005, 10:20 AM   #3
Senior Member
Registered: Aug 2003
Location: Barcelona, Catalunya
Distribution: Gentoo
Posts: 1,042

Rep: Reputation: 54
I agree with cavalier, but then, is there an MS-DOS undelete equivalent for Linux?
Old 03-14-2005, 10:44 AM   #4
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 5,390

Rep: Reputation: 409Reputation: 409Reputation: 409Reputation: 409Reputation: 409
That depend on the filesystem in which this file was stored, but it is a tedious procedure
see for example

ReiserFS Data Recovery Tips
Old 03-14-2005, 10:50 AM   #5
Senior Member
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 47
About the only way you can have a "Trashcan" equivalent in Linux is to alias the "Delete" command to a "Move" operation instead.

You could get pretty sophisticated with it, mind you. A bit of shell script work could make a 'trash' command that:

- Stores a trashed file's original permissions and locations in a log somewhere

- Sets all trashed files permissions to 400 so nobody can snoop your Trashed stuff

- Deletes Trashed files after a certain length of time

- And is paired up with an 'untrash' command that'll restore the file to its original location & permissions by reading the Trash log

But at the end of the day, it'd be a lot of work.

Mind you, rm'd files CAN sometimes be restored. If you want to make absolutely sure a file is gone when you delete it, take a look at the 'shred' app - this repeatedly over-writes the file contents with random data, making it a very secure deletion application.
Old 03-14-2005, 11:02 AM   #6
Registered: Mar 2005
Location: Canada
Distribution: Slackware
Posts: 47

Original Poster
Rep: Reputation: 15
I will look into 'shred' app.. ty

also.. thanks for the other replies.. I was hoping there was no trash can.. so thats perfect..

couple other questions:
Are there temp files stored somewhere that I should be deleting?? or any files in general that build up?? Also, is there any such thing as defragmenting with reiserfs ??

Old 03-14-2005, 11:06 AM   #7
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 5,390

Rep: Reputation: 409Reputation: 409Reputation: 409Reputation: 409Reputation: 409
Defragmenting is done on the fly with nearly all linux file systems, no need to defragment manually.
Old 03-14-2005, 03:20 PM   #8
Registered: Sep 2003
Distribution: Slackware 10.1, Slamd64 10.1, IpCop 1.4
Posts: 125

Rep: Reputation: 15
Originally posted by numb
I will look into 'shred' app.. ty
One note, shred is not effective with journaling filesystems like reiserfs.

From the shred man file:
CAUTION: Note that shred relies on a very important assumption: that the filesystem overwrites data in place. This is the traditional way to do things, but many modern filesystem designs do not satisfy this assumption. The following are examples of filesystems on which shred is not effective:

* log-structured or journaled filesystems, such as those supplied with

AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)
As far as I know, no shred-like deletion program is effective with journaling filesystems. I used to use shred, but stopped after moving away from ext2.
Old 03-14-2005, 04:07 PM   #9
Senior Member
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
If you want a "recycle bin" or "trash can" like rm script, you could rename /bin/rm and create a shell script in its place. What the shell script would do is move whatever you want to remove into your desired holding place (e.g., ~/Desktop/Trash in .kde, etc.). Or, because other programs rely on /bin/rm for their functions, name your new shell script "trash"

BTW I think some filesystems actually have routines which write over the file rather than simply remove the hard links (reference/directory entry). I haven't gone through the source so I couldn't tell you which file systems do and do not do that. I'm fairly certain UFS does though (not used often with Linux but is often used with Solaris and OS/X)



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

Similar Threads
Thread Thread Starter Forum Replies Last Post
I changed the trash can icons but now the full trash can icon doesn't show? Why? Ausar Linux - Newbie 6 08-04-2004 01:59 PM
Everything went to the trash!!! Gerardo Mandriva 1 01-22-2004 04:52 PM
Where Is My Trash? thorman82 Linux - General 9 01-01-2004 07:40 AM
Trash DavidTempler Mandriva 4 10-15-2003 07:38 PM
trash can loganwva Linux - General 1 11-26-2001 05:41 PM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:27 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration