You are not logged in.
There are also the -i or -I flags.
Offline
alias then add -i to ask you if you are sure you want to delete
set up sudo
backup backup then backup
MrG
edit take a look at foremost
Mr Green
Offline
It would be nice to patch rm so that if you try to delete an important directory like your home directory or /, it will ask for your password or the root password again. Is this possible?
The program 'rm' was like you see it for about 30 years. Is there so much need to change it for someone that couldn't think twice before press 'enter'? When you are root, you are thought to administer your system (so you *must* watch your steps), not wishy washy. If you want to change some files, just fix the permission on them with root (one command, not definitive as 'rm') then modify them as simple user.
syntaxerrormmm - Homepage
Offline
I disagree. First, you're assuming that the only important files are the files owned by root, but that's not the case. I praise my own documents much more than the system files. Besides, we can't be 100% of the time on full attention, we're humans, and we make mistakes. That's why I have '-i' in many of my alias, but it's not a complete solution. Some apps, like gcc, may overwrite your source file if you type 'gcc file.c -o file.c'. It may seem a silly mistake, but it's really easy to happen, especially if you're using the shell auto-completion.
This is a problem especially bacause there's no easy way to recover a file after a rm (or a mv/cp overwrite). Maybe a five minutes interval between the rm and the actual desallocation of the file blocks would be more than enough. Generally, the person realizes WTF they made shortly after pressing enter.
Sorry for the half off-topic rant. So, between my brother and my /home, I'd choose my /home, but I don't have a brother anyway.
PS: rm having 30 years just says that it's old. We can't infer nothing about its quality just because of its age.
Last edited by andre.ramaciotti (2009-05-12 13:10:58)
(lambda ())
Offline
It is also possible to recover the files deleted by rm command http://www.cyberciti.biz/tips/linuxunix … files.html. IMO Linux expects the user is more responsible for what he/she is doing with the system .
Maybe a five minutes interval between the rm and the actual de allocation of the file blocks would be more than enough
A function in bashrc with alias to rm will do the job I believe (to execute the command with a final warning to the user) .
Last edited by kgas (2009-05-12 14:45:16)
Offline
http://www.xs4all.nl/~carlo17/howto/undelete_ext3.htmlyes, this seems helpful since the author made it.
I've googled a bit, and this thread is just another result where someone else asks for help and people answer, "Yeah,hopeless."
Shit I deleted my files too!
I was doing at $HOME: $ rm -f BG/anna-p<Tab><*><Enter>
just to delete all those freaking ugly pictures of anna-p***** after deleted several using Ctrl-del when viewing with feh... And there was only one left to delete! <Tab>hence brought a space at the end and I appended "*"...after the space! all files in my $HOME is dead and gone now. Well at least folders are left alone and alive...
Never press Enter too soon when you have rm with -f, never. Even you really feel it urgent to get rid of some garbage, always use -i.
Last edited by lolilolicon (2009-05-27 07:03:47)
This silver ladybug at line 28...
Offline
I have lost any important file.
Unfortunately my ex-ex-ex-ex-boss did this to some very important files with global financial data in them while moving a server. He spent days trying to recover them, to no avail.
This was his first lesson in making backups
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Backups won't help everytime*. Imagine you coded in a rush lots of lines of C, debugged it and then, when you were to compile it 'for real', you mistyped 'gcc file.c -o file.c' . You'll probably have no backup as it was a work in progress and you didn't stop to backup it, so say goodbye to your code. This may seem a silly example, but it does happen, especially when you rely on you shell autocompletion system.
*Well, I'm not saying 'make no backups, they will never help', but accidents that happen in between backups being made, and there's nothing you can do in such cases.
OT: fukawi2, you're not 1337 anymore
(lambda ())
Offline
OT: fukawi2, you're not 1337 anymore
GADS! I completely missed my most 1337 post ever!
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
If backups don't help maybe put everything into RCS?
Offline
If you remember to commit the changes every now and then, then it's fine.
But it still have the problem of changes that are made between commits can't be rescued.
Last edited by andre.ramaciotti (2009-05-27 12:53:04)
(lambda ())
Offline
jwcxz wrote:It would be nice to patch rm so that if you try to delete an important directory like your home directory or /, it will ask for your password or the root password again. Is this possible?
The program 'rm' was like you see it for about 30 years. Is there so much need to change it for someone that couldn't think twice before press 'enter'? When you are root, you are thought to administer your system (so you *must* watch your steps), not wishy washy. If you want to change some files, just fix the permission on them with root (one command, not definitive as 'rm') then modify them as simple user.
I completely understand your point. Ever since I accidentally typed rm foo * instead of rm foo* while in my home directory, I've always checked twice before issuing a rm command (imagine if I had used rm -rf instead!). But the problem is that everyone makes mistakes sometimes.
I'm not talking about changing it for everyone; that would be stupid. I too hate constantly being asked whether I *really* want to do something or not. I'm just talking about changing it for me. I think I was a little tired when I last posted; instead of patching, I meant wrapping.
-- jwc
http://jwcxz.com/ | blog
dotman - manage your dotfiles across multiple environments
icsy - an alarm for powernappers
Offline
But it still have the problem of changes that are made between commits can't be rescued.
Than I suggest automatic saving of documents and rsynced backups off-site every 2 mins + tar & gzip into 'backup.09-05-27_16.18.25.tgz' :-D Those backups could be deleted after 48 hrs so you would be left only w/ your regular ones.
Last edited by karol (2009-05-27 14:22:20)
Offline
Offline
Well, I see that there are benefits to slow typing ;-)
If you're about to do sth dangerous, you might want to 'dry-tun' it first.
Offline
Offline
Seems a no-brainer but I saw it happen several times: "*Of course* we have backups!" And and an hour later "Oooops ..." :-)
Offline
[metoo]
fsck once went up in flames and thought that every single file on my linux partition was a lost inode. I left it and it managed to put almost every single file into /lost+found/. Don't think I'll ever not make a backup for two months again. Damn, but that was a lot of time recovering from that one.
[/metoo]
In all seriousness, though. A decent backup system (even if it's just an external hard drive that you copy /home to every month!) is more than worth the money. A 500GB external hard drive nowadays is what? $150? $200? If you don't have many photos or much music or video, then that will last you a long time. Sure, it's no protection against an earthquake or a fire, but it's still better than nothing.
Remember this one rule: every once in a while, backup everything, *not* just what you think is important.
Side note: I use git to manage my configuration files. When I make a change, I commit the change. It works pretty well.
-- Lagaro
There is no darkness in Eternity/
Only light too dim for us to see.
Offline
After reading this thread I've decided to put some "security" in rm.
So I'll add this alias to my bashrc:
alias rm='echo = "last chance before screwing things up 10s..." && sleep 10s && rm'
It might be a bit of an overstatement but better than losing all my /home documents or /...
Last edited by Primoz (2009-05-27 20:10:55)
Arch x86_64 ATI AMD APU KDE frameworks 5
---------------------------------
Whatever I do, I always end up with something horribly mis-configured.
Offline
What do you need that "=" for?
Offline
What do you need that "=" for?
I don't know I thought that you need it for echo...
Guess I was wrong even though it still works .
Arch x86_64 ATI AMD APU KDE frameworks 5
---------------------------------
Whatever I do, I always end up with something horribly mis-configured.
Offline