Undelete In Linux
Manuel Arriaga writes "[To the editors: I am not a professional programmer, nor will I ever be one. My income does not depend on my computing/programming skills, and hopefully it never will. So promoting free software I wrote does not help me in any financial way, no matter how indirect. libtrash is free software (GPL2), and I distribute it for free from my website. I have nothing to gain from the increased exposure, except for knowing that I am helping others. And I know slashdot isn't freshmeat... With that out of the way:]
I have seen this topic discussed in the LKML multiple times by now, and many more people asking in the newsgroups why "I can't recover my deleted file on GNU/Linux".
Here is my answer to that question. libtrash gives Linux a real "trash can". And it has been doing so (with varying degrees of stability) for more than one year now.
If you consider it appropriate, make this information public on slashdot."
slashdot isn't freshmeat
Yes. So let's not have software posted on the front page, eh?
http://ask.slashdot.org/article.pl?sid=02/09/29/02 7256 for a similar discussion.
PDHoss
======================================
Writers get in shape by pumping irony.
Get it right...
I thought the idea of a linux trash can was pretty neat.
lighten up, eh?
... to this: askslashdot.
I can't believe how many Windows users get caught out when they dual boot my machine into Windows (have to have it for the office because others use my workstation) and find I have disabled the Recycle bin. Haha, more fool them.
Disclaimer: take with a pinch of salt. If you have sodium issues, take with a pinch of Lo-Salt instead.
Conversion Rate Optimisation French / English consultant
now we have almost everything we need:
[x] Trashcan support
[ ] Easy to use Windowing system
[ ] Standard software install system
[ ] Easy to use Windows filesharing
[ ] Easy support for video files and DVD
[ ] Desktop company support
Way to go LINUX!
Come on, recycle bins are no fun at all. Where's the fun in having the files you "delete" stored in a folder until you REALLY want to delete them. It's much more fun to delete files knowing that there's a chance you may need them in the future and have no way of retrieving them (unless you're responsible and back your files up, but then again, what's fun about being responsible?).
"Herbivores eat well cause their food never, ever runs."
I once accidentally did an rm * .~ hoping to just get rid of some emacs floaters. That really sucked, but it was the *only* time I've ever wished I had a way to get back something I deleted.
I don't understand why there are so many people saying this is bad or implying that people who use Linux don't need it because they are so good. I must have missed the evolutionary step that made all Linux users so perfect that they never make mistakes. That is all the Recycle Bin is.
Sure, some people use it as temporary folder, but so what? There will always be people who use things other then the way they are intended. If it works for them, so what? If it is so painful for you to contemplate, don't look at it.
[x] Trashcan support
[X] Easy to use Windowing system - KDE
[X] Standard software install system - LSB, Red Hat, Mandrake, Suse
[X] Easy to use Windows filesharing - KDE, Samba
[ ] Easy support for video files and DVD - No answer
[X] Desktop company support - Red Hat, The Kompany
Way back when Apple sued Microsoft for ripping off the look of their interface, Apple lost. The ONLY thing they got the judge to concede was the Trash Can was theirs. Thus, MS changed to a recycle bin -- a sideswipe at the Apple-California neo-environmental stereotype.
The editorial cartoons of the time were great. One showed a picture of Jobs carrying a trashcan full of legal documents with someone commenting "At least the judge let you keep something to carry all that home in."
Learning HOW to think is more important than learning WHAT to think.
Why is there no README or any other info on your site about this thing? I want to know how it works and how it is different from alias rm='mv ~/.trash', or the KDE trashcan, before I download it. Man I hate sites like this that expect you do download the package, then untar it, just to read a README file. How hard is it to throw it on your website with a link?
I have been using computers for over 20 years. I have never, ever, ever 'accidently' deleted an important file.
I'm smart enough to know what 'delete' does. I don't need to be asked if I'm sure. (Yeah, on second thought I don't want to delete it?). And I don't need to have a recovery system if I delete a file.
One of the more charming aspects of *nix is that it's designed by and for people who have a clue. The more you make it easy to use by the common user, the more it becomes bastardized.
Why do I see linux not including a command line in 5 years.
The Internet is generally stupid
If you wanted to be really clever about it, you move them outside of their account (so their quota does actually go down) and then clean them up automatically if they've been in there longer than 30 days.
If they want to "restore" something, they just mv it from the Trashcan to their account.
Of course, this is command line only stuff, but if that is all you need then it'll do.
Avantslash - View Slashdot cleanly on your mobile phone.
when I was in college some people and I did a Linux Undelete on the kernel using the ext2 filesystem. The whole procedure is described on http://amadeus.ece.uprm.edu/~undelete. The problem was we didn't found enough people to supported on greater kernels. I think it could be easily ported to ext3.
Sometime during the early 2.1.x development kernel series someone added code to add an undelete facility. The last x files deleted would instead get moved to a pseudo .directory and remain there until a restart or until additional files were removed.
This feature disappeared when 'dentry' support was added to the filesystem code circa 2.1.43.
Please ignore the idiots above -- the l1nux-l337 are always a pain in the butt about usability issues. As a response to the ask-slashdot rfe from last week, this works really well.
As a point of note, those of you complaining about the disclaimer in the article should realize that, if the disclaimer hadn't been there, you would be complaining about how "/. isn't an advertising service, you Window$ Idiot!!111!11!!!11!!"
Sheesh.
While a trash can is nice to have, this doesn't fundementally address the issue of retrivability of accidently deleted information. That is, there is still going to be a step where information is going to be classed as unretrivable even when it COULD be retrieved. (i.e. when the trash is emptied)
Clearly users appear to want to be able to correct mistakes that they've made -- perhaps even those that were not immediately apparent as being mistakes at the time -- for as long as possible. A trash is a step in that direction, but simply does not go far enough.
My proposal is this: 1st it should be recognized that when you delete a file, you're really only marking the space where that file was as being available to be overwritten by more data. The original data is there, but what it consisted of, and where it was, are lost.
So, let's keep that information in a log so that we can in a very real sense undelete anything that has not yet been overwritten. This log is not especially large, and with modern drive sizes is not a serious concern.
Then, let's order the overwriting process to favor the maximum preservation of data. So for example this might result in new writes being done to the areas of the oldest deleted files first. Important files might be considered to be worth preserving longer, with importance dervived from various factors such as number of accesses, etc. prior to deletion. There's definately work for some user testing here to determine the optimal method. That's okay.
If fragmentation is a worry, (bear in mind most people have never heard of it) then defragging software could take into consideration the undelete log and continue to preserve as much of the deleted data as possible when it shifts information around on the disk.
In any event, the objective is to forestall the day when you have to tell a user who wants to undelete a file for as long as possible. Not longer, which the trash solution does, but AS LONG AS POSSIBLE.
-- This and all my posts are in the public domain. I am a lawyer. I am not your lawyer, and this is not legal advice.
As it seems to be software announcement day on slashdot, I'd like to announce the project I'm working on...
libpaperclip
Yes, that's right - clippy comes to X Windows!!!
I was thinking about filer last night, and this morning, we get libtrash. People have always had issues with deleting files. I personally keep a ~/bla/ directory. I move unneeded things there. If I don't need the files after a few months, I trash the directory, and recreate it. The concept is still better then an undelete, but I remember deleting some very important files on my first linux system... like vmlinuz and the /boot directory because I did not know better.
Just one more thing to worry about in the security world. As is the 1GB email mongers aren't bad enough. Now UNIX Admins will be trash collectors too.
"Could everyone delete some files? We're running out of space on the server. This would include your trashcans as well."
Response:
"Doesn't the janitorial staff take care of that?"
Unix has entered the world of the clueless.
"...the shortest distance between two points may be straight line, but it is by no means the most interesting."
What we need now is the Gnome (or KDE) panel set LD_PRELOAD so that all application can use libtrash.
-- 1.e4 c6 2.d4 d5 3.Sc3 de4: 4.Se4: Sd7 5.Sg5 Sgf6 6.Ld3 e6 7.S1f3 h6 8.Se6:
I'm so happy this exsits.. now I don't need to maintain those god awful daily backup / restore deamons..
lol..
You opensource developers always amaze me.
another option... for those who have a yard of paper work to go through to install anything from the net....
just remove the rm command and, alias it to copy
I can't really see the difference... it also gets backup nightly.. lol... don't forget to kill the ftp->rm function.
-nasu
"What do you do with the mad that you feel when you feel so mad you could bite?" - Mister Rogers
So, what happens if you send something like ld.so, or your kernel into the recycling bin? Experimenting by randomly moving stuff you don't understand is never a good idea. Just sending it to some sort of recycling bin just gives folks a false sense of security and could lead them to completely hosing their entire install.
mkdir ~/trash /bin/rm -rf /home/*/trash" >> /etc/crontab
/me nods
alias rm="del"
echo "* 4 * 1 *
del:
#!/bin/sh
mv $* ~/trash
"Quoting famous computer scientists out of context is the root of all evil (or at least most of it) in programming." - K
Obviously someone wasn't around for the great RM stampede of 98...
Don't delete anything, till it has been backed up. You do back up your data, right?
If we can educate newbies not to run as root, they shouldn't ever be able to actually mess with the running of their systems.
:)
/home/wastepapaerbasket' would produce the required result. And a crontab that find /home/wastepaperbasket -atime +7 -exec rm {} \; would auto clean the old ones for you.
Of course, they'll still be able to delete stuff in their home areas, but we all have to learn the hard way
Of course, alias rm = 'mv "$1"
Get your own free personal location tracker
Back in like '94 a friend of mine in school wrote an Ext2 undelete program, which of course I no longer can find online... He doesn't have it listed on his webpage any more.
Having your users accustomed to "undelete"
just makes it that much more harsh when they
learn that something delete from a remote filesystem is irretrievable. "Undelete" creates bad habits.
-fb Everything not expressly forbidden is now mandatory.
I flipped over to another virtual desktop and found that GNOME has already provided me with a trashcan. (More like Mac than Windows.) I never use it, though.
If this is a trashcan for command-line rf, I can see how some people might want to use it. Not me, though.
Secession is the right of all sentient beings.
Thanks.
Karma: Bored. (Thinking about resurrecting the "Anyone else is an imposter" joke.)
http://freshmeat.net/projects/recover/?topic_id=43 %2C19%2C137%2C142
I've been a rabid Linux user from the early days. Today Linux handles DNS, Email, and Web services on my networks...it does NOT handle file access for JUST THIS REASON (lack of undelete).
.XLS file). Excel says it's corrupt (it's a Word document now).
I'm not worried about *me*. When I delete something I fine with it being completely gone. What about completely clueless network users though? Being the MIS/IT MGR for where I work having access to "salvage" on the Novell Netware file servers is a wonderful tool for users mistakes.
Classic example: last week one user created a Excel spreadsheet to be completed by another user. The second user opened the spreadsheet from Word, modified it, and saved it (as a
Getting the inserted table [spreadsheet] from Word back into Excel was next to impossible. Crappy Microsoft programming as usual -- and clueless users to boot. Easiet solution was to salvage the original spreadsheet and instruct user what NOT to do and re-enter the damn data PROPERLY this time.
Linux would have left me high and dry. Well, not really, but having to go back to tape backups to simply salvage one file is a pain in the butt.
I guess Linux will be nothing more than a niche product/market if "gurus" keep their attitudes posted here. Wake up and pay attention to corporate users and admins wants/needs. Telling me I'm clueless and wrong won't gain more market share (well, for Linux at least) -- I've recently bought another Netware license to cover just this issue for another remote office.
I've just finished developing my libtrashtrash program. It puts a trash can inside your trash can. That way, you can delete files, and then empty your trash can without fear of accidentally deleting something you need. You can install it as many times as you desire. Each subsequent install will create yet another step between your files and oblivion... enjoy!
Once upon a time I wanted to delete a couple stray mp3s I had in my home directory, so I issued the following command:
.mp3
rm *.mp3
Or so I thought. I had actually accidently told my linux install to do the following in my ~/
rm *
If you cannot tell, there is a " " between "*" and "." As you can imagine this has a very undesired effect, even though I saw it quickly after hitting enter and mashed the ^C as fast as I could.
Undelete would have been useful then. Yes, its a dumb mistake.. but things happen!
Scott.
How about something as simple as rm -i ??? Or the many solutions aliasing rm to 'mv .trash'? Or ...
Seems to me that we have a hundred diff ways to accomplish the goal of making it difficult to delete a file. Now, do I really want to delete a file. Well, if I type rm, then I am pretty sure I do. And, I do not make mistakes with this. Sure I did when I was a junior admin. How do you think I learned to be careful before deleting?! How do you think I learned to not use root for general use?!?!
Besides, I hate the concept of the trash can. On my windows machine (gameOS for playing Counter-Strike) I have my trash can disabled.
Greg
Greg Whalin
greg@whalin.com
Wow, you are so special and smart.
So what's wrong with providing a solution to those who want a trashcan? Maybe you are so much more experienced than most users (what 20 years of computer use? AMAZING!!!) but what's wrong with giving people an option?
You only "bastardize" it if you make it mandatory.
something like "grep -A num_after -B num_before "string from file" /dev/disk"?
..good for the desktop nuts.
/" *chuckle*
I despise trash cans, recycle bins, core waste dumps, et cetera. If I delete something, then, damnit, I want it to *stay* deleted. And even in my newbie stages of Linux use, I never fell for, "Oh, just hit rm -rf
Even my mail program, what with its trash folder.. I hate that. I have to delete spam *twice*. I shouldn't have to, but I do.
However, you people must realize that many, many desktop users are so dependant on having a trash bin that it isn't funny. I, personally, know people whom would sit down at a computer and suddenly explode into small chunks, suitable for stewing, if they deleted something by 'accident' and couldn't get it back through undelete.
Should these people learn that delete is a powerful command, and shouldn't be invoked lightly?
That's not even a question here. But until they do, let 'em have their small guise of safety.
I think that you are on to the right solution.
Perhaps the thing to do would be to use two file tables. The first table would be used normally as it is today. It would represent existing files and provide the correct information regarding space usage etc.
The second table would only be used by the file system and the recovery utilty. The second file table would maintain the information of the files that had been marked for deletion and the file system would consult this table prior to saves so as not to overwrite the files that were marked for deletion.
When the disk becomes full, the file system should consult the second file table and overwrite the oldest file that had been marked for deletion.
Also, the recovery utility could consult the second table, listing the files that were marked for deletion but, still reside on the disk. Files selected for recovery could then be added back to the first, primary file table making them again available for the user.
I'm not sure how Novell does it but, the above method would yield the same behavior as the Novell system.
For anyone who's ever had the pleasure of using a NetApp Filer, or similar product, you know that rolling snapshots are the way to go. Much more gracefull solution than the trashcan. Though I'd settle for .trash as well.
I've done it twice in seven years. Yes, it sucked. Big time.
Pretty goddamn wordy. There's more disclaimer than story here...
I am alone, yet I also surf the universal backwash of undifferentiated Being, which is LOVE.
WTF if you aren't SURE, don't delete it. With that said a trash can is a good idea. The difference it makes seems merely cosmetic, but for people with a lot of "clutter" it's important.
A lot of times I will use some file and know at that point that if I don't use it in three days, I will never need it again. On a busy day there may be many of these files. A trash can saves me the trouble of having to comb through directory after directory three days later.
On the other hand a real undelete utility seems pointless if you have a trash can. In real life we toss things in the trash and the sanitation dept picks it up. If we threw out something we needed most of us just ACCEPT that its gone. We don't go digging through the local landfill. While use of a trash can doesn't, really deleting something serves to free up space on your hard disk. Not in 1989, but in 2002 if anyone is deleting files solely to free up space and then needs a utility to recover those files, they just need to get another disk.
sig
No, I'm not special and smart.
I just am uncomfortable with the idea of linux trying to be more like windows. It shouldn't and doesn't have to do that.
So everyone can stop calling me pompus or whathaveyou. If you want a windows like OS, get windows. If you're looking for a very user freindly OS, get windows.
If you like to play with things and get under the hood of your computer, run Linux (actually, I run BSD... but I'm not touching that debate with a 10 foot pole).
The Internet is generally stupid
Perl?! Perl?!?!
/bin/rm /bin/rmv /bin/rm.sh /bin/rm.sh /bin/rm.sh /bin/rm.sh /bin/rm
Here. Enjoy, under the, uh, Poetic Licence V1.0...
mv
echo '#!/bin/sh' >
echo 'mv $1 ~/trash/' >>
chmod +x
ln -s
alias empty 'rmv -ri ~/trash/*'
Jesus, Perl. People wonder why modern distros take up two DVD's these days! Shit, you can probably do the above without all the mucking about with shell scripts, I'm just too lazy to think about it, because it's already that easy anyway!
I know in my heart that there's no need for this on Unix, because you shouldn't run as root AND use rm -rf and THE decide that you shouldn't have done that. There are safeguards in place and, after all, since you're a Linux superuser, you're either good enough that you don't make that kind of mistake or the system isn't important enough for it to really matter.
/bin`. Funny story, though:
/big. That was the first mistake. I have no idea why I felt the need to mount it that close to the root. Although the similarity between "big" and "bin" is obvious in retrospect, it is, after all, retrospect.
/big` and immediately pressed return (I found that return is also a mysterious part of that autocompletion).
/bin. Among them, all of the shells, chmod/chown, grep, kill, ls (try working without that), mv.... the list goes on and on.
Having said that, even though I know how dumb it was, I once accidentally issued `rm -rf
For some reason or another, I happened into an additional hard disk that I put into my Linux box at work (not a production box). I don't remember how big it was, but it was big enough relative to my primary disk that, when I needed a mount point, I chose
Actually, that wasn't my first mistake. My first mistake was running as root.
I mounted the disk and played around with it. I suspect that it was my first time playing around with an additional hard disk, so I copied files over and examined "df -k" and so forth, and eventually I guess I decided to unmount it and do it all over again... I probably would have done endless, mindless file copies for the rest of the day, I was so thrilled with it. Hey, I was young.
This is where it gets embarassing. Perhaps everybody has some mysterious glitch which adds confusion where there should be none. Yes, I honestly do know the difference between a symlink and a mount... I swear it. But in the very brief period of time that it takes to type a command, I sometimes confuse the two in my mind and try to unmount using the "rm" command. More specifically, "rm -rf".
I also noticed on that day that we humans have kind of a built-in autocompletion. If you type the first few letters of your last name, you have a tendency to follow through with the rest of it. And that tendency increases dramatically the closer you get to the last letter. The way I noticed this was when I attempted to issue `rm -rf
Just so you know, there are a great many important things in
This story also reminds me of the time I evaluated WS_FTP Server when it first came out. I needed an FTP server so I could go home and work on some files on an NT server. I wanted access to the whole box, so I set up my FTP account's home directory as c:\ -- I had no idea that when I deleted that account it would attempt to delete the user's home directory, even if it was c:\.
I've never heard a disk thrash like that before or since. And you've never seen anybody turn a box off as quickly as I did when I realized what was going on. Alas, it was too late. Reinstallation and backup restore (yes, I had a backup) commenced immediately. By the way, I've never fully accepted responsibility for that -- I still feel like it should have said "You're about to delete c:\ and all of it's subdirectories. Are you sure?" Because I really didn't think it would do that.
Anyway, my point is that "there, but for the grace of a godlike substance, go you". It's really easy to say we're too good for this, and there's a damn good case that a linux trashcan is not necessary, but for those who want it I think it's a cool piece of code.
That is all.
RP
really? That's you. That's not the majority of people out there. Some people really want this. Especially the people that feel that Linux should become part of the desktop market.
I don't see how people could believe that your post was "Insightful". It's not Insightful it's trash (no pun intended).
This is something that would make Linux *more* attractive to Joe-Blow. Come on.
Hate it when a funny story is screwed up by a blatant typo:
"you shouldn't run as root AND use rm -rf and THEN decide that you shouldn't have done that."
Sorry.
A Unix admin (We'll call him Bob BOFH) would just add a cron job that does for file in $(ls /home/);do rm -rf $file/*;done every week. An even better admin would use find, but thats left as an exercise for the user....
/home/ with whatever your local Unix uses for user directories.
Replace
17+2i
lysergically yours
Often, when I clean out my papers, binders, and whatnot, I end up throwing out stuff that I do need. Being able to root through the trash and retrieve it five minutes later when I come to my senses is very convenient.
Yeah, yeah. I am not leet.:)
Is this a sigs-optional kind of place? 'Cause I am totally down with that if you know what I mean.
Novell Netware's FS worked almost exactly like this. It was a wonderful feature. I don't understand why more implementations have taken this into consideration...
http://kered.org
I run BSD too; let the "compete with Windows" crowd bastardise GNU/Linux to their hearts' content; I want my BSD!
It got me too. If the cron job has the same aliases as your logged in users, it will try to run the aliased rm that runs del...and the files wont get removed.
/bin/rm to something else and use that in your cron job to get the "real" rm that you want.
Either ensure that your cron user doesn't get the rm alias, or rename/link
True though; a library to do this is very, very, silly.
Why do pencils have erasers?
considering the prologue that was given to the "announcement"? I had to reread the title and the little snippet a few times to figure out what the hell this thing was. For a split second I thought it was an Ask slashdot question.
So If Apple has legal rights to "Trash Can" and MS has "Recycle Bin" I think we should call it the "Grot Shop", as our repository for rubbish... in honor of Reginald Perrin.
I always did like the way the Brits commonly use the term "rubbish" for trash. It's got a classier sound to it.
After losing eight hours of editing work during a botched backup attempt, I heard about a utility called safedelete. I can't find much on it, but here it is from Ibiblio. Interestingly, the person that told me about this utility (which sets up a trash directory with timed expiration and a system of aliases for rm and related commands) was an old Unix hand, and only secondarily a Linux user. The program works fine in Debian, I can report.
And I don't get these people saying they are too smart to need an undelete capability. Must be nice!
*** "Freiheit ist immer die Freiheit des Andersdenkenden". -- Rosa Luxemburg ***
Your app doesn't intercept the unlink system call. it intercepts GNU `rm'. Most applications don't use GNU rm to delete files.
Having a trashcan means deleting junk twice. It's an unnatural interface. Just as annoying are the pop-ups that ask me "are you sure you want to ...".
*nix operating systems attract me because they are customizable and fast to use after you set them up. The difference between the interface of a *nix system and Windoze is the difference between adolescence and some toddler pointing and crying "MUH!!".
I certainly like macs more with BSD underneath.
People don't like to learn. But you got to. You are living in the Digital Age(tm). Past ages where people had to learn included the Stone Age, Bronze Age, and Industrial Age.
I like the fact that this guy is contributing to Free Software. Props. But I don't ever go through my garbage looking for half a cheese sandwich that was in the fridge too long. If the bums outside want a wack at though more power.
YeeHaw
Couldn't you just write a quick perl script to set up a "trash can" by temporarily moving your files to a "trash" folder? Then, make a switch for the perl script that will "take out the trash" when you want it to. I don't see what the big deal is about having to write a full library for it nor why this is utterly important. If you want a trash can, write a perl script to do it. If you don't, then leave rm the way it is.
Remember, perl can do everything.
[x] Trashcan support
[X] Easy to use Windowing system - WindowMaker - quietly delivering the usability other noisier projects only aspire to for years.
[X] Standard software install system - *cough* it says *standard* - Tarballs
[X] Easy to use Windows filesharing - KDE, Samba
[X] Easy support for video files and DVD - see http://mplayerhq.hu/
[X] Desktop company support - Legions of answers here, a competitive marketplace is good for the consumer.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Friends don't let friends enable ecmascript.
Yea, I mean who the hell would want to add functionality to something?!? I say screw adding any type of functionality for linux, regardless of how many people might want it because it's obviously good enough as is. :-P That's what you meant in a nutshell, right?
Mistakes happen, what's the problem with having the ability to correct them?
Now that some poor fool has described the method for aliasing rm in order to move files to a trash directory, everybody's an expert. The problem is that it's *still* a hassle. You have to first make the alias, then create a desktop folder if you want a different directory than GNOME or KDE default. And all applications still don't use your directory by default. I think the many 13-year olds reading slashdot need a different attitude than "Good design is for losers".
"I am not a professional programmer, nor will I ever be one. My income does not depend on my computing/programming skills, and hopefully it never will. So promoting free software I wrote does not help me in any financial way, no matter how indirect."
so you want me to download your buggy, rookie, non-professional code to mess with files on my drive?
rm /* instead of rm .*
:-).
deleted my kernel image
Is it that hard?
And this my friends is the attitude keeping Linux from wider acceptance......
I can't believe nobody has mentioned the AFS equivalent to this, which is a ~/backup directory that has all the files from your latest backup. Can't delete or modify any of the files in ~/backup. Why can't some of the Linx filesystems implement this?
Technically, you can use a pint mug to drink champagne. But most people prefer to use a champagne glass or a flute.
;-)
Personally, I prefer to simply hit "delete" to move files to a preset temporary directory (which can also remember where those files originally were, and restore them with a couple of clicks) than to have to manually drag them to a directory I created.
If this kind of "commodity" seems pointless to you, then you probably program by writing machine code with a text editor.
RMN
~~~
So, what happens if for some reason the feds (or some other unscrupulous organization) siezes your hard drive and digs up everything you've deleted for the past 6 1/2 years?
"It's a very tangled subsystem." --Windows kernel guru
(the code may be fine - but it's an answer to the wrong question.)
In a world where 40GB discs are the smallest available you have to wonder why we continue to use the old filesystem ideas. For ordinary home use a filesystem that remembered it's entire change history and only deleted stuff when the disk was full. A kind of RCS filesystem where you could roll back the state of a file, directory or entire filesystem should be possible.
Some apps would have to be modified to perform differently so they did not consume the entire space in trivial file changes.
For the audio/visual editors it probably would not be useful but for SOHO and home systems it would be ideal.
This type of thinking is aligned with the Cathedral model of software. GNU/Linux is free, and because it is free there is no real notion of 'market share'. The open source / free software movement is based upon users helping users by sharing their ideas through written programs. If a sysadmin wants an undelete function, he should write one, and release it to others. This helps the 'community' not only an individual or single company. Someone in your position has little to complain about, if you are using GNU/Linux and have not contributed ANYTHING, you are (in old warez terms) 'leeching'.
I personally have no problem with people doing this, but it is very arrogant of such users to point the finger at everyone else and tell them that they NEED to include this function and that function, when they are contributing and you are not.
(By the way, I am not saying you have not contributed, because I do not know you. I am simply assuming that since you are saying 'Linux needs this' you are depending on others to do work that you may benefit from. This is not a personal attack.)
"I guess Linux will be nothing more than a niche product/market if "gurus" keep their attitudes posted here. Wake up and pay attention to corporate users and admins wants/needs."
I have the solution! and it can be a HUGE moneymaker.
i prepose the e-landfill. an online service that you can configure your trashcan to use a daemon process (garbagemand) that automatically ships the contents of the trashcan via a secure protocol (rubbishtruck/garbagetruck.. as known as RT/GT) to the e-landfill.. there the deleted file can pile up forever or at least until it is full then we just open up another landfill!
Great idea!
Do not look at laser with remaining good eye.
Actually I have been doing this for several years as an admininistrator and developer on a UNIX box. This software appears similar to what I have done for my users and myself which is rewrite the "rm" command in the users profile. All users including myself have had the rm command supplimented to mean "mv [file] /home/$USER/garbage."
:) Oh, by the way this has been a stable release for about 8 years now or since I first learned it could be done. I have had 100% success with no failures. :)
I then have a cron job that runs to evaluate the age of the files in the garbage directory. It will automatically clean the garbage directories of all files that are older than 14 days. The cron job currently runs once a day.
By the way I even caught I a guy that one of the companies I worked for hired to do an attack and penetration test because of this little fact. He set a job to run after he logged out to clean and clear out the general and host specific log files. He did not account for the fact that I change the rm command's meaning. I found his file lingering in the garbage directory of a temp account. HEHE... gotta love UNIX.
"Help me Obi-/.-Kenobi,your my only hope!" -$
Ok, to all the assholes spewing crap like "I never lose important files," OR "when I type rm, I mean rm"....
1. Bullshit.
2. Even if you don't make mistakes, the rest of us do.
3. Who the hell gave you the idea that linux users=perfect? Seriously.
4. People like you are the reason why new users don't try linux. I don't ever want to hear the phrase RTFM again.
5. Linux is an OS, not a religion. Knock off the dogma.
6. What part of your pathetic little lives are you trying to compensate for with the condescending, holier-than-thou attitude?
Give it a rest. The great thing about linux is the diversity. Not all of us spend 18 hours a day playing with our linux boxes - some of us actually get laid. Try it sometime, might loosen you up.
I just am uncomfortable with the idea of linux trying to be more like windows.
... slashdot will do that for him.
Huh. So Bill doesn't have to claim credit to inventing everything in the history of computing
On slashdot, it seems all discussions inexorably lead toward Microsoft. Y'all must worship that company or something.
a package called 'entomb' is mentioned in unix power tools rev2 (o'reilly book...). it requires recompiling rm/mv/cp/etc against it, but it changes the way your system unlinks things.
e BSD
after some digging, i found it was no longer where it USED to be at purdue's ftp site, but i was able to locate somebody that's actively using it as a base for undelete functionality in freebsd: http://www.itso.iu.edu/staff/ajk/projects.epl#Fre
perhaps you should contact him, or do further research on the entomb package. as an aside, the unix power tools cd has a 'delete' app that functions by renaming files (prefixing them with # iirc) and then doing something along the lines of a find nightly to actually delete old versions. you could simply hack something like this together for yourself and alias rm to it...
Would someone mind actually try it out instead of debating the use of it or not? -from OS X
Oh wait! Uh... damn.
There is no need for a trashcan...quite running as a priveleged user. Pay attention to what you are doing, and if you manage 'rm -rd /*', you have once again proven evolution has skipped you.
"Simon Says, Fuck You" - George Carlin
I'm not as concerned with how it's done- I just have too much luck with the salvage tools under netware.
There are several big advantages to the salvage methods:
- Good PR for the IT guys. "Oh, you deleted that file? Let's see if we can get that back. Hey look, it's magic."
- Less tape jockey time. "I deleted that file and wo I need it! Can you restore it from tape?"
- Intelligent users recognize the value of it's revisioning. I can roll back to a version of the file I saved at 10am. I may have nuked 18 pages of my 56 page document and then saved it broken. No prob, salvage the earlier one.
Anyway- my users are quite used to it now and can't comprehend getting along without it. It's a service they rely on and it boosts our value as IT guys to them.
I can't replace my filesevers with something that doesn't understand file salvaging, that includes and MS server or linux server.
If redundant, my treshold = 4
This problem can easy be solved.
My solution as a linux-newbie-user.
I use bash, I made an alias
del *.* = mv *.* to some trash-folder
(I don't remember the exact code you have to enter, but for you guys that should be easy)
I used to do this some time ago, untill work forced me back to windows. Now Mandrake 9 is out, I can't wait to give it a try.
It's Gebhardt :-)
Free Software is a wonderful concept. Too bad that in practice most Free Software is total shit.
GNU/Linux is the biggest offender. There's no overall design or architecture. It began as a piece-meal reimplementation of an already messy system design (UNIX), and evolved into an even worse house-of-cards hack job.
The Free Software community would be doing itself a HUGE favor if it would DUMP all the "GNU" and "POSIX/UNIX" aspects of Linux and instead rework the Linux kernal to be the center of a much more sensible operating system design.
Functionality such as undelete/trash can, a centralized way to install and remove programs, a centralized place (and format) for storing configuration settings, a single (and consistent) GUI in which all apps play nicely together and utilize the same exact widgets/style/etc, should all be fundamental aspects of the system's design from the start, rather than being attempted as hack jobs on top of an already sloppy system.
In other words, no amount of makeup or plastic surgery can ever make Janet Reno beautiful. If you want to win the beauty contest, you have to start out with the real deal.
Moderator hint: a comment is neither "Flamebait" nor "Troll" if it is true.
ftp://ftp.physics.purdue.edu/pub/pundits/entomb-3. 9.tgz
/tmp (just plain
from the readme:
Source Contents:
The subdirectories in this directory contain the essential parts of a
file entombing system.
README This file.
Pkg.sh This shell script to build this package.
lib/entomb The source for a program that will entomb a file.
lib/libtomb The source for a library which provides entombing system API.
These system calls cause a fork/exec of the 'entomb' program, above.
etc/preend A daemon which makes sure the tombs don't get too full of
corpses.
bin/unrm A program that may be used to retrieve a file from a tomb.
bin/rmfile A "micro shell" to help novice users delete or entomb files
with nasty names (like "~", "-", and " ").
bin/untmp A quick spell to remove all my junk from
files, not subdirs). This cleans up well for run away mktemp's.
Paper A document describing how to install the entombing system,
and an (outdated) technical paper describing the system in detail.
Personally I don't have a big need for a trashcan. And most *NIX vets barely need it. Only the masses may have need for such stuff, specially when so many Windows users are coming up. However I would damnly congratulate the nerd who would put in default such a feature on the next distro. Every experienced hacker knows perfectly that trashcan solutions are frequently THE reason for loosing performance. For individual removals this may look no so critical but when things come up into whole folders and thousands of files, we get some trouble.
Anyway a save removal system should be potentially in place over every file system. Moreover, this safety mechanism should be inherent to the filesystem itself. With the chance to choose what I want to safeprotect or not. Under such approach we could meet a middleterm between performance and safety. Besides such approach would allow to cover a problem where most backup systems can't have a voice - safeguarding highly critical data in a more realtime basis. Yes, such safeguarding mechanisms will not be good for the real realtime situations. But they would be quite good for protecting and recovering by-hour or by-minutes cases. Sometimes this is much more important, rather than picking up last-day's archive and forcing the user to type his last hours of work at the end of worktime and having the boss yelling "I want it now!!!".
If such mechanisms would be implemented they could find a very important niche among sysadmins working with certain types of information - document files, legacy databases, big amounts of data and so on. However such mechanism should regard some safety concerns of confidentiality and control. I fear that in lamers hands it would be much preferable to see the old damn Recycle Bin in their hands.
What I'd like is a bash option to refuse expanding a naked "*". If I really want to delete everything, I would rather type something like "rm ./*" It's a little too easy for tab expansion to leave an extra space you don't want, and let a star go wild. One big place this goes wrong is when you deal with a symlink to a directory, it should always try to put the "/" on the end of such a path.
hmmm..
lets see
mkdir ~/trash
mv file.i.want.to.trash.but.may.want.later ~/trash
rm -fr ~/trash/*
blamo a linux recycle bin
lets get a little sicker now and script the deal
#!/bin/sh
#move stuff to trash
#filename trashit
mv $1 ~/trash
#!/bin/sh
#empty the trash
#filename emptyit
echo 'This command will remove the entire contents of your trash can
Are you sure you want to do this?Y/N[N]
'
#commands missing because I dont feel like #actually writing this and debugging this at this #point in time
rm -fr ~/trash/*
Hasn't this been included within nautilus for quiet sometime now? I know that with GNOME 1.2, if you let nautilus draw the desktop - a 'Trash Can' exist and functions similar to the Windows/Mac trash can...
But notice that pencils do NOT have un-erasers.
Rubbish
As far as I know, both Gnome and Kde have this kind of feature for some time now.
If we are talking about deleting stuff in a terminal then Windows hasn't got recycle bin support in the ms-dos prompt either.
So, um, what if you like to get under the hood and accidentally delete a file? Why is it so horrible to give users a choice to have a trash can if they want it? I realize that at only 23 I don't have the wisdom of your 20 years of computing, but I've been on linux since a friend turned me onto it at 15 and I know there are times I would have liked to be able to undelete. And why does it matter to me if you're uncomfortable with my having a utility you don't like? And why do you perceive this as Windows-like? If you want to do everything from a command line and be uber-l337, be my guest, but don't tell me what I should and shouldn't do on my computer. Communist.
do not read this line twice.
From the FAQ:
"Take this object, but beware! It carries a terrible curse!"
The advantage is has over some recovery options is that it's entirely post-mortem. If you just deleted the boss's laundry-list, you could go download it, build it, and stand a pretty decent chance of recovering your file.
The disadvantage is that, perhaps like a real autopsy, it's not for the faint of heart...
alias rm='mv $* /tmp/'
or $HOME/trashcan/ if you prefer.
Tony
1 reson why i use linux is it tends todo what
its told.
therefore when i delete something i expect it
to be deleted and never show up again.
people say joe user needs this.
how many joe users put a important letter in a
bin at home then pull it back out again ?
I think underlete should be handled at the application level, ie. in konqueror and nautilus, etc. Maybe alias rm to something else for the command line.
Sticking feathers up your butt does not make you a chicken - Tyler Durden
Getting the inserted table [spreadsheet] from Word back into Excel was next to impossible.
Hardly.
Step 1: Select table in Word
Step 2: Copy table to clipboard
Step 3: Open new Excel Spreadsheet
Step 4: Paste table back into Excel
Sept 5: Give original user license to beat the clueless person who messed up his/her spreadsheet.
well after the lusers on the network
delete a file by mistake they learn not
to delete it the next time after they
spent 8 hours overtime redoing there work
to get it in on time. This is called learning from experence.
but is it not true that windows + networking
has no trashcan ?
This appears to work by placing itself ahead of the normal libc when it comes to dynamic library loading. Very neat idea, but it won't work on libraries which don't delete files by making calls to the shared library. The most common instance of this will probably be statically linked binaries. On FreeBSD, almost all of /bin (including rm) is statically linked, and it wouldn't surprise me if this was true on a Linux distro or two.
So be wary of just installing this and playing with rm - you might give yourself a nasty surprise :) You can check whether rm is statically linked by running ldd `which rm`
The only use I see for something like this is one abstraction layer from major GUI toolkits like GTK and QT. I say this because the only times I have problems such as accidentally deleting a file are when I'm using a GUI, and decide to use menu options (such as in GQview). If I'm looking at some photos that were emailed to me, and I want to move them, what if I accidentally click the 'delete' option, which is right next to it? Those files are lost.
I -can- see the use for it, but I don't really see any reason why it should be one level below console (which is what I'm assuming this library does). Granted, there are times that I would have found it useful, even a life saver, but that was due to my carelessness. People really shouldn't be allowed to be careless with computers.
~/ssh slashdot.org ssh: connect to host slashdot.org port 22: too many beers
When do we get to hear from Gore's new foreign policy advisor MEATHEAD?!?!
(And which political party does Hollywood own?)
um.. you DID touch it
I suck.
s/libraries/binaries/
It is a really efficient way to do this. It was initially done, I think, in 1984 or 1985...
I think the code that's there is for BSD 4.3, but if you've already done the library work...
The overview reads:
Currently Andrew J. Korty is working on a project to port the code to current FreeBSD.- "History shows again and again how nature points out the folly of men" -- Blue Oyster Cult, 'Godzilla'
heh i once new sombody who liked to delete things
/*
like that then he made a typo and hit space
rm -rf .
put this in /etc/profile
alias rm='mv ${1} $@ ${HOME}/.trash/'
emptytrash() { cd ${HOME}/.trash; rm -rf *; cd -; }
Who needs a trashcan when you have debugfs? :)
Slightly off-topic, but not far :)
I once had a rather unsavoury experience with RedCarpet (ximian) in which I found that I wanted to remove Ximian gnome from my RH 6.0 system, as it was bloaty and slow. So, I selected the core gnome libraries from the remove list, and assumed (dangerous) that it would also remove anything which depended on those libraries.
it did. It also removed _every other rpm_ on the system. don't know why, and I don't know why it didn't warn me either. Things just stopped working, one by one, as the hard disk thrashed.
So, undelete. No, I probably couldn't have used an undelete utility to rebuild my trashed RPM database, and I probably couldn't have fixed that problem anyway, but some way of retrieving those directories with custom configs it had somehow managed to remove without so much of a by-your-leave (--force on, then) would've been nice.
While I agree with the original post, some whiners wre worried about intercepting unlink too. Well a month ago there was a discussion about using "cp -al" with rsync to back up a disk. This would work here too. "cp -al /" makes a set of duplicate hard links to all your files. This is fairly space efficient though not free by any means. The bonus is that you get more in return, you have a perfect image of your hard disk at an earlier time.
Some drink at the fountain of knowledge. Others just gargle.
instead of "Recycle Bin" or "Trash Can"...
How about the "Shit Hole"?
or just the "Shitter"?
or "Refuse receptacle"?
or "Cum Bucket"?
or "Whore's Twat"?
or "Oprah's Bung"??
or "Litter Basket" ? yeah that's it
Bug: /path1/myfile /path2/myfile
$ del
$ del
Oops, you just overwrite the first "myfile" in your trashcan.
This is the single most important and useful utility for windows I've ever seen. It's so good that microsoft stole the idea and has included a (half-assed partially functional) version of it in windows XP.
It's less useful under linux because it you never have to undo configuration changes and program installs, but it would still be really nice.
It doesn't take *ANY* extra disk space, though there is a minor performance hit. Rather than mark the space as immediately reuseable, it marks it as used for it's logging, and when more space is needed on the disk, it frees up the oldest parts of the log. This can result in fragmentation, of course, but that doesn't happen as much as you would expect, due mostly to the patterns of usage.
On a large, not much used disk, you can easily keep months and months of backup.
For those who aren't familiar with it, goback is a true logging file system - it logs all changes to the file system, to the point that you can say "show me what this file looked like at 7:30 this morning" and it will. You can also mount a virtual disk - including writing capability - to see what the disk looked like last week. If you accidentally revert the hard disk to last week, it lets you revert to this morning, before you reverted to last week. It's impossible (well, difficult, anyway) for even a dumb user to screw up.
I've been using Linux (Slackware, then SuSE) almost exclusively for awhile now, and this is the only thing that I really miss. Is there a true logging file system for linux? Not that I know of!
Please tell me where I can find one?
[X] Easy to use Windows filesharing - Linneighborhood
h bo rhood.html
http://packages.debian.org/unstable/net/linneig
For all of your pathetic Windows needs...
come on fhqwhgads
That was a learning experience. (Some distributions are more trustworthy than others.) We finally ditched SCO when we couldn't format our new ESDI disks because the driver would crash the system when it encountered a bad sector. (Remember ESDI?) We called the $1200/yr tech support, and they insisted that they couldn't help us unless we "reformat the disk and reinstall Xenix". After three attempts to explain that that was precisely what we were trying to do, (and them responding that "I can't help you if you won't follow instructions"), I lost my temper and told them they were blithering idiots and they'd never hear from us again.
We limped along replacing broken SCO utilities with GNU software, and finally switched to Motorola.
So, what happens if for some reason the feds (or some other unscrupulous organization) siezes your hard drive and digs up everything you've deleted for the past 6 1/2 years?
Then be sure to let me know about it, because that's one bad-ass unerase utility right there.
-Waldo Jaquith
Maybe I'm not the first to point this out, but isn't this redundant/unnecessary? I'm using Linux every day and in the GUI Gnome and KDE both have perfectly fine trash cans. In the command line when you do an "rm -rf" or something like that, the files are gone, but it's the same in Windows. If I use the command prompt to "del" a file, then the file is GONE, not in the recycle bin.
What's wrong with that? If you are advanced enough to use a command line then you'd better be advanced enough to know when you want to permanently delete a file!
I think the guy who made this software is forgetting that the average Joe Blow Linux User isn't going to be using the command line very often (if at all), so this software is irrelevent...
So you must never wear a seat belt either because you've never been in a fatal car accident.
Nobody that's been in a fatal car accident wears a seatbelt, either.
-Waldo Jaquith
But, I'll point out that deleting the wrong JPEG can certainly break apps that haven't had their error handling written properly. The difference is you and I know how to recover and replace that JPEG even if it has truely been nuked from our systems. Not everyone does. I'd say that's the "comfort difference" between us and "Joe-user."
I'd also point out that moving a file to a tmp folder is *using a trashcan/recycle bin,* you just don't think of it that way. . . and neither does Joe-user, which I guess is half the point. When I first booted up Linux and realized, " Ah, no trashcan," it took nearly a whole second to think, " Well, if I want one all I have to do is make a directory named 'My Trashcan like Place' ( or George, or whatever)and alias rm to mv foo George." But then I wasn't your typical newbie.
Ok, to make it a full blown trashcan some sort of simple database to track where each file came from to effect automatic restores is also needed for Joe-user ( renaming it foo./bar/fred/barney works for me on those rare occasions when I think this is necessary), but the basic idea is simple and to me was obvious and trivial to effect. I guess to Joe-user it isn't.
But as you say, if it isn't the default behaviour, and needn't even be installed on *your* machine, who gives a damn? Are we going to start sending out " You moved that file to a tmp folder instead of deleting it" police?
Any controversy over this is just plain silly.
KFG
That's funny -- my KDE desktop already has a trash can. Kind of old news, isnt' it?
What's so horrible about just NOT TYPING "rm", and using "mv to a ~/.Trash directory" instead?
_rm_ is a low-level command-line "delete" command. The command-line analog of a GUI trashcan is NOT "rm", it's "mv to trash"
I have a suggestion. If you're looking for a good player for DVD's and video files, check out xine. http://xine.sourceforge.net It doesn't come packaged with a decrypter for encrypted DVD's, but one is easily downloadable and installable. So far, I've found few problems with it.
I'm sure everyone else is going to be asking the same thing, but why do you need a cmd line trash. The 'normal' user who doesn't understand that when you delete something it goes away forever isn't going to be using the cmd line, they are going to be using x-windows, most likely in the gnome or kde flavor. Its pretty easy to make a folder named "trash" for them to drag stuff into if they don't want to delete it.
If I decide to go drag racing in my brand new Cobra 2003 and total it, is it the fault of the manufacturer or the fault of me?
What if I don't have a drivers license?
Why the fuck should YOU care, if I fubar any of my own stuff? As long as I don't hurt anyone - who the fuck cares?
We do not live in the 21st century. We live in the 20 second century.
So in othe words...
If Microsoft develops a concept (or Apple in this case I guess) that might be useful to Linux users, we shouldn't develop something similar because instead we should just buy Windows? That is just plain stupid.
Linux is nothing like Windows and it will never be. But there is nothing wrong with adding functionality that people will find useful, although, I can't see why one wouldn't just make an alias to do this instead as another poster mentioned...
If this is the kind of division I see on a topic as simple as "Should Linux have a default Recycle/Trash Bin", how the hell is the community supposed to unite to make Linux a desktop power?
i'm amazed that i survived - an airbag saved my life.
Couldn't you just make a directory--say /opt/trash--and write something along the lines of..
/opt/trash?
mv $ARGV[0]
then let the user clean out their "trash" when they've confirmed that they don't want something?
when salmon are outlawed, only outlaws will have salmon
Slashdot has had major software announcements for a long time. The idea is to provide an interesting medly of content that keeps nerds happy. When PHP forum bugfix notifications start coming up on Slashdot, then you can complain
There's been a lot of discussion about having a form of undelete in Linux on Slashdot. This is quite relevant.
May we never see th
Well, no. Real men have a sex life. ;-)
RMN
~~~
cd /; chmod -R 444 *
Seriously, why does anyone need a trash bin? Disk capacity is so ridiculously large that there is no need to ever delete anything. If you need to reorganize, make directories like oldjob, oldstuff, etc and just move the stuff into there and forget about it. It works just like a trash bin, except that you don't need to worry that the stupid machine will empty it.
The Mac OS had a Trash Can from its introduct in '84. I believe that the Apple IIgs shipped with an OS with a Trash Can, and it wouldn't surprise me if the Lisa did the same.
May we never see th
Bravo! Go for it! agitate for the needed changes!
You filesystem needs the following things:
A command to list, look at, revert to, and/or copy from previous versions of a file.
A command to list, mount, or revert to previous versions of the filesystem. This would ideally be available at boot time.
:>\-i yes it looks like line noise or an emoticon, but it's really a shell script. This protects against rm *.
/etc, /bin), and type :>\-i
so cd to all of your really important directories (/,
what it does is create an empty file named -i
when the shell expands * the first file it lists is -i, which rm interprets as an option for interactive mode, so you have to confirm each deletion.
I am thoe original author of this shell script, consider it GPLd.
I always mount with noatime. Nothing I hate worse than constant background writing on my hard drive.
May we never see th
mplayer is a bitch to install, but awfully simple to use once it's in. And in terms of performance and flexibility, it can't be beat.
May we never see th
And I've only been using Linux and BSD since December of 1999. Now, if you need an undelete tool, you're welcome to it. If the distributors want to put undelete tools in their default install, more power to 'em. Nobody's forcing me to use an undelete tool or choose a distro that includes undelete tools, so why should I care if you need or want one?
I always thought that the great thing about GNU/Linux and BSD was that once the foundation was laid (kernel, system tools, LSB-compliance for Linux) the system could be customised for any purpose. Want to make a desktop system for laymen? Go for it. Want to make a BOFH's wet dream? Hey, we can do that too. That's supposed to be the strength behind open standards.
If you really want retrievability, consider using version control and doing nightly backups. Version control for the stuff you actually change (instead of just create and delete), and backups for everything (including your version repositories). It's far more robust than just a silly trash can.
Sure, a trash can might save you from silly typoes in an rm command... but it won't save you from editing mistakes or file overwriting.
Glad to see that your every descision is flawless and that you apparently backup all your files every 15 minutes.
And what percentage of "normal users" install their own software instead of getting someone else to do it for them on Windows?
May we never see th
if you don't know how to change your system to testing or unstable thats your problem.. don't cry about it on slashdot.
Fantastic ! You'd have to tag each of the garbage bags with the address of the original owner so that undelete works, but it'd sure make "Private Investigation" a lot easier.
This isn't an issue of "lighting fast". The proposed solution, at least without serious modification, would massively fragment the hard drive. The only reason you don't *care* about fragmentation is because you enjoy the pleasant fruits of the fragmentation-resistant ext2, so you don't realize how bad fragmentation can get. The proposed system would fragment the filesystem so badly that a well-used FAT32 system would look contiguous as hell.
You could make a usable system that's somewhat similar...it could shift files around and use, say, a third of the free space for old files.
May we never see th
And the last time I looked debian stable had XFree 4 ... ( still using "testing" though ;-))
( the old "testing" has been the new "stable" for a while now
Most of these people (above/below) are not asking for a "trash can". (Tho' kudos to the guy for making it -- another choice.) These people are asking for archive capabilities. (Even *indows archives older, less-used files. Ever notice the little blue files? ) If you are afraid you might need something later on, write it to a CD instead of deleting it. (or have a cron do it by date of the file or something.) This is not so complex. What am I missing here? (I really used to like the way Novell archived your servers by the date of the files.)
Dad32
whatever.
It shouldn't be all that hard to do this in-kernel, so it doesn't have library-preload dependencies or side effects and catches even stuff that comes into the kernel from unexpected directions. All you need is a dirt-simple filter driver that you push on top of the filesystem to change delete/unlink calls so they move stuff into the trashcan, plus some ioctls to view/empty it.
Oh, wait, Linux doesn't have filter drivers. For a moment there I forgot we were talking about a "technically superior" OS.
Slashdot - News for Herds. Stuff that Splatters.
If your friend is new to Linux and won't be using the console much, then have him use the KDE trash can. Even right-clicking files will bring up the option 'Delete' or 'Move to Trash'. I'm not sure having something in the command-line to automagically move files to a trash folder is good. But having it in the GUI, where new users are likely to hang out, will be a good thing, and KDE is already there (well, the choice between 'Delete' and 'Move to Trash' might be confusing for some).
Before I started using Linux, I installed the "Black Hole" on my Amiga. Crap went in and never came out again.
1. It's very likely that whatever the undelete command was, that it would have been in the bin as well. It's unlikely that you've be able to run it from the trashcan and unlikely you could have gotten to it without the contents of /bin.
2. Undelete is not for 'rm -rf'. It's for deleting a copy of that invoice/letter/utility you know you'll never need again, only to get a phone call ten minutes later.
That's why you use the old trick of having a file named something like "-normstar" (or anything that begins with '-' and which isn't an rm option). rm chokes on it as it scans argv[] for options, and won't delete your files.
just don't have a file named -rf
must... stay... awake...
There's also the whole problem of library incompatibilities, which is part and parcel of the decision to make shared libraries the standard way for software to work on Linux. That's a classic example of reducing ease of use in return for better performance (smaller downloads) for more sophisticated users.
Find free books.
Are we going to start sending out " You moved that file to a tmp folder instead of deleting it" police?
Yes, and they will dispense savage beatings.
Tanget first: The thing that pisses me off the most about windows installers is that they insist on going full screen and requiring you to close or ignore background applications while they are running. I don't want my machine to be useless during an install. Let me start the installer and then do something else while it's doing whatever rediculous crap installers have to do on windows.
One good thing about Windows Installer is that the install is an atomic procedure. That is, if it fails for any reason (file missing, user cancel, etc.), then it will completely roll-back and not leave bits of a partially installed application.
I call bullshit. First, if the installer crashes the system then you're still left with a mess, so it's hardly an atomic process; It only appears atomic if it ends cleanly. Everything else you're describing is handled by any decent installer (including RPM, and dpkg), so it's not something that is nice about the MS installer in particular. Worse, Windows doesn't properly handle unused shared libraries when handling dependancies. Since they are part of an application package they can't be easily uninstalled seperate from the application, but the default behavior is to not delete libraries marked as shared even if their usage count is zero. You need to pick one or the other: delete the libraries when no one needs them anymore, or package them seperately so that they can be cleanly uninstalled. This is one of the most broken parts of Windows.
My point is, is that while it's possible to use different front-end installers, they all use the same back-end, unlike the different Linux package systems.
Each distribution has it's own package management system. On a particular distribution, there is a common installation back-end that is for managing uninstaller applications (usually scripts since administrative tasks are easily scriptable on linux, unlike windows) and dependancies. Stop trying to spew FUD. It's a moot point anyway, because a typical linux distribution is not hampered by a monolithic configuration database, so there is no need or benifit to a unified installer backend in the form you're describing about windows.
Dos never had a trash can, and it seems from the previous posts that most people using the command line for file management don't really want one. A system wide trash system could be used by viruses, etc. and seems very unUnix-like. Best to keep the desktop things on the desktop and quit trying to turn linux (i.e. lower level linux) into monolithic windows.
I simply set up ENV var called $trash pointing to ~/trash... then just do:
mv blah $trash
works fine...
you are wasting your time. Equipment to recover these files costs on the order of US $2000... you're not stopping many people, huh? When you really want them gone, you should burn your hard disk platters until very little remains and scatter the ashes over the sea.
.sig: file not found
How 'bout the compost? Stick crap in there and you get a heap of dirt! Um, well, may be not...
---
Open Source Shirts
Purdue had an unrm package when I was a sysadmin there in 1995, and it was old then. It worked by having a new unlink() that could then be merged in with libc (if you were brave) or linked to separately so you could have /usr/local/bin/rm instead (if you weren't), along with tools that understood how to read the filesystem tomb and restore files from it, and a daemon (preend) that cleaned the tombs of old files. Unfortunately, it has never been extremely portable, since it involves rewriting unlink(). It had pretty much everything you could want in an entombing package; but I don't know if anyone has picked up the ball with it. Last I heard they were having trouble porting it to the newer versions of FreeBSD; check out this note from Purdue ECN.
At least mafia-owned pizzarias make excellent pizza. Compare to Bill Gates.
When you remove a file, from anywhere, it is saved. This means Nautilus, shell prompt, FTP client, whatever. (Tricks involving editing .bashrc need not apply.)
When you overwrite a file, it is still saved. This means if you save a huge edit to a file and then regret it, you can recover the previous version. If I am not mistaken, libtrash does not handle this case.
You can specify some files/directories to not be backed-up. NPRB allows you to specify wildcard patterns, such as "C:\Temp\*" (anything in C:\Temp) or "*.bak" (any file ending in .bak). I like the wildcard feature for "*.bak" and such, but I would also like to see this new kernel feature do the right thing with the "chattr +u" flag, which Linux has had forever but doesn't acutually do anything.
You specify an automatic date for the backups to be purged: e.g., anything older than 3 days old gets purged. A user-space utility running on a cron job would handle this nicely.
There should be user-space utilities that allow for recovering a deleted file (to original location or to someone else), and for purging all the kept files to truly get the space back. (And I want a nice Nautilus interface for this stuff.)
When you are up against the wall on disk space, the oldest files get purged automatically to make enough room for a file write. (This one would be nice but I could live without it.)
This would be nice on servers, but I also want it on the workstation!
NPRB is the one big feature available in Windows that I really wish for in Linux.
steveha
lf(1): it's like ls(1) but sorts filenames by extension, tersely
A couple of years ago I heard about something called the "snap filesystem" which would allow for recovering deleted or overwritten files. But I haven't heard of it since, or seen anything on the web. Does anyone know anything about a "snap filesystem"?
steveha
lf(1): it's like ls(1) but sorts filenames by extension, tersely
Actually it is better than Window's trashcan.
Trash can = works well in Windows GUI.
Just you drop to DOS/NT Command Prompt and
use 'del' to remove a file... its gone, it's not in the trash can, because its the GUI API layer that does the trashcan stuff.
Linux's trashlib unlink() function works for one and all....
This is primarily intended for backups of volatile filesystems, such as databases. You would backup a database like this:
suspend database transactions
wait for pending transactions to finish (so database indexes are consistent)
make a snapshot
resume database transactions
backup the snapshot
remove the snapshot
.mp3" in your home directory, the snapshot would be a huge help. You would get back everything over an hour old.
But if you have a lot of free disk space, you could set up your system to make a snapshot every hour, and keep the snapshot for, say, 8 hours. Then you would have a coarse-grained undelete.
If your shapshots happen on the hour (1:00, 2:00, 3:00 and so on) and the user creates a file at 1:02 and deletes it at 1:40, the snapshot won't help, which is why I call it coarse-grained. But if you accidentally do "rm *
It is specifically for snapshots that I plan to try out LVM on my next file server.
steveha
lf(1): it's like ls(1) but sorts filenames by extension, tersely
first, i commend this cute hack.
/etc under CVS automatically, even though it's easy to do yerself.
however personally, i like to keep as much of my computer life under CVS as possible, because recovering deletion is just one aspect of the many ways in which i screw up regularly. that includes my home directory, zone files, system configuration files, etc.
it would be neat if a distro (like debian!) put
-- p
/bin/recycle
I hereby place the above post in the public domain.
Wow, great idea. Noone ever thought of that before. Now make it work so that when you delete a file from within a program such as nautilus or emacs they also go to the trash.
Read Unix Haters Handbook for a hint...
Chaz
True its embedded into the interface and not from a raw terminal, but since 99% of the people that need the feature will be using a desktop of some sort, it would be effective to them.
( i assume GNOME does too.. )
---- Booth was a patriot ----
Absolutely.
It doesn't happen often but when a user saved over an older version of a document in our DMS (iManage) we could count on Salvage to get it (or any other previous version) back.
Having migrated to Samba on Linux for File/Print we now have to resort to tape.
If you don't want to repeat the past, stop living in it.
Good, so use Netware, buy Netware it obviously does what you want. If you don't want a user to accidentally delete something make sure that like every other admin you backup up there directories. FIND a way to work around it.. under a unix system it's easy. Every 1 hour have a script that runs that backs up the users directories to another partition or where ever you want, if someone creates an original file have it backed up and saved, if a file with the same name is created make; use iterations.. It's not difficult. Linux hasn't left you high and dry you're just to lazy to write a tool that will do what you want. Who's fault is that?!
If you've been a rabid Linux user from the early days, then you've had at least a good 10 yrs to figure this out. Everyone else seems to be using Linux for everything including file servers. How this got modded up is beyond me.
I dont mean to trash this software, no pun intentended,but seriously I personally have not found the lack of a trash can a problem. If it works for you then fantastic.
I think the problem lies more in the fact that most people really don't know how computers really work and microsoft pushes user stupidity.
Why is it winders users can learn all these arcane command key combos, software patch maddness, and deal with the total lack of a simple directory/drive structure and yet the logic of the recycle bin stumps them?
What really scares me is microsofts invasion on the school systems. Kids learning all about computers on an asinine OS and think that it is normal.
What linux really needs is a file browser, I shudder every time I have to build tkdesk on a new system and love it when I get it working.
The evil 16 y/o hacker in my from years ago jumped out when I read you comment...
Putting a file called -rf in a commonly deleted directory could be interesting! I would have never thought of that.
But, yah, that a good idea.. putting a -normstar file in the directory.
Scott.
I'm not trying to frustrate you. I see where you are coming from on the fragmentation issue and I see where this might be a problem in some cases.
Frankly I want this feature more for servers than anything else, although having it on the workstation is an added bonus. But, in terms of servers they will usually use RAID and mine always use RAID 5. In this case fragmentation is often beneficial.
But, the server arguement is just an excuse. The fact is that if fragmentation is such an issue then this proposed file system should not do fragmentation avoidance as ext2/3 does but, rather perform defragmentation functions with a seperate utility as is the case with M$ file systems. I've got no issues with a CRON job that runs a defragmentation process in the wee hours.
One final note: I can assure you that the Novell guys aren't taking your approach -- only overwriting something when they absolutely have to do so.
This is absolutely exactly what the Novell file system has done since v3.1 and has been maintained in all 9 versions since then, right up to today's Netware 6.0. Granted, I don't know how it's coded but, this is definitely the resulting behavior. No file is overwritten until the disk is physically out of space, or very near it. The only exceptions are those that are explicitly configured to "Purge" immediately. If your disk hasn't run out of space, say a really large disk or a really quiet server, it's possible to Salvage a file from six years ago, even if the server has been rebooted everyday.
Now I'll have Linux developers with a full 20GB drive, 19GB of which is the Recycle Bin.
I haven't read all of the posts, just enough to get a feel for the general sentiment - anyway thanks for pointing out that it takes a non-programmer, who never made a dime programming, in fact, to write a functional trash can for Linux. This is something that I will probably never use, but thousands of others WILL use it, because they need it/or are used to having it. By the way, on the Mac it's called the Trash Can and on the SGI it's the Dumpster (yes Unix desktops have this feature) and these both make sense because you are throwing files/data away. So, why does MS use Recycle Bin are the words an and the suddenly in short supply?
That is the biggest problem I have with users and Trash/Recycle Bins. They never empty them. The minute I get the call "I'm out of disk space" I ask if they have emptied the Recycle Bin. 99/100 times, they say "oops" and hang up.
MS Recycle bin has a limit on size, but how friggin hard could it be to set up something which natively (no extra cron jobs to stuff into each one of 150 machines, please) deletes anything that has been in the trash for more than 2 weeks?
I don't use a "trash can" on my home linux computer per se, but I do run Logical Volume Manager and one of the _best_ features is the ability to take a snapshot of a logical volume.
/mnt/snap every Sunday morning with enough space (1G) to last all week. During the week I can then recover any file that existed on the previous Sunday morning, but there was no lengthy "backup" process or tape drive or anything. I like it very much.
/etc/cron.weekly/lvsnap: /mnt/snap /dev/big/snap >/dev/null /dev/big/rh >/dev/null /dev/big/snap /mnt/snap
The snapshot uses zero bytes when you first make it, and then as activity happens on your drives it records changes (imagine a "super-diff"). The amount of space you need to allocate to the snapshot depends on how long you want it around and how frequently you write to disk.
I decided this is useful when automated so my home computer makes a place called
Here's my
#!/bin/bash
umount
lvremove -f
lvcreate -L 1G --snapshot -n snap
mount -r
BTW, I don't even have two HD's on my LVM. I just imlpemented it on my main drive for the sheer geekiness of it, i.e. cool features like this one. Yes, before someone points it out, I realize theoretically with just 1 drive LVM makes it slower rather than faster but (a) I didn't notice any speed difference, probably because my CPU is fast, and (b) it's a non-critical home computer.
I'll go for the easy argument:
If all your files are in a RCS... shouldn't it be a function of the file system?
Don't Delete Shit You Want to Keep!
.darxyde.
Well said.
Back in the day I remember removing all of the production perl/php/C scripts I had been working on for six months in one foul swoop.
Didn't have much of a problem running 'man debugfs' and working out how to retrieve the files.
nor did I have a problem aliasing 'rm' to 'rm -i' incase of future carelessness.
And if you absolutely need to keep certain files - take a friggin backup. Humans will be humans I guess and make mistakes, but it's not hard to avoid tears.
Hey relax fella, you need a rest, guy.
Whoomp!
There's no place like ~/
I don't really know enough about the subject to give any sort of informed opinion, but that's never stopped me before....
Since Linux already has a swap-file partition and there are opposing views on if it should be added to the file system for various reasons.
Why not have a partition strictly for the *Recycle Bin* (or whatever is deemed "worthy" for Linux). As I understand it it could solve a few issues such as it could be formatted to solve multiple version issues as well as restore location information and you have a fix disk space that would be used and you wouldn't have to worry about emptying the trash as it wouldn't help you any. The format could work much like the salvage command in Netware mentioned a few topics ago, never truly filling the drive as it just overwrites the oldest files first.
Anyways, enough babble from me... I don't know what I'm talking about.
Wiwi
"I trust in my abilities,
but I want more then they offer"
use trash can, I have a suggestion alias rm "rm -i" .
My Aurora : http://www.youtube.com/watch?v=o91ZsGwJYyg
FB : https://www.facebook.com/TanveersPhotography
Windows
.oh wait, the facts don't matter here -- what's more important is to gloss over Linux's shortcomings -- by misrepresenting Windows -- instead of DEALING with them.
Start > Settings > ControlPanel > Add/Remove Programs
You CAN use other programs' individual installers if you WANT, but you don't HAVE to.
. .
Well, Joe User can learn from his mistakes and never make them again. Didn't you ever learn from your mistakes? I bet the first time you did an rm *, you payed more attention to it again. Why must there be an undelete to coddle Joe and teach him bad pratices?
Actually, it would be even better if delete actually wiped the actual blocks so that files were completely unrecoverable.
[hongli@izumi src]$ rm -rf .*
rm: cannot remove `.' or `..'
rm: cannot remove `.' or `..'
[hongli@izumi src]$
Your "mistake" was part of the solution. Do a "rm /bin/rm" and you never again need to bother about accidentally deleted files.
As you can see, I don't do this a whole lot. After all, I was brought up believing that deleting a file is DELETEING a file.
Overrated / Underrated : Moderation