This might seem scary because what if you didn’t want to delete the file, or whatever? Well, there are a lot of reasons that the “delete it without asking” philosophy is better than the “ask this dumb question again and again” philosophy. We can fight about this if you want. But I’ll tell you this: When you switch to Linux and operate that way for a while, then go back to an operating system that is always asking you “Are you sure you want to do this thing and are you sure you want to do that thing” every freakin’ time you want to do something, you realize the value of a system that simply does what it is told. Let me elaborate further as to why Linux is better than Windows in this regard:
1) The total amount of time you spend saying “OK” to every single stupid question is much greater than the benefit of the occasional “oops” moment;
2) Chances are, if you did not really want to delete the file, this is not because you pressed the “delete” button in a passing moment of derangement. Chance are, what happened is something went wrong and you are not totally aware of that. For instance, Windows threw a widow in front of your mouse while you were doing something else, or some other stupid thing happened. When this appears on your screen:
Do you bla bla bla
you are going to hit “OK” anyway. And the file will be deleted anyway.
3) Despite what I’ve said above, most/many Linux desktop environments, such as gnome, have a “trash can” … so even though you are not being asked again and again “do you really want to delete this,” when you do delete a file with the GUI file management software, it goes into the trash directory and not the blottosphere.
4) When you are working on the command line you are really working with the equivalent of an interpreted computer language. You do not want feedback from your commands in almost all cases. If a command routinely gives you feedback, especially the kind where you have to answer a stupid question, how do you string it together with other commands into a script?
5) When you are working on the command line (and often in other contexts) on a Linux computer, you are actually working in a world that is different from WindowsWorld or even MacWorld. This is why Linux is not for everyone. You are driving a stick, not an automatic. You are stretching your own canvas, not buying some dumb movie poster to hang on your wall. You are loading your own cartridges. You are taking personal responsibility for your own data and processes.
So when you consider removing a file, you must also consider at that time if this is something that can happen with no backup at all or something that should never happen without backup, or somewhere in between. You decide, and you do it that way. You chose between converting FileA to FileB or transforming FileA in place with the old version eliminated.
Having a system that constantly assumes otherwise is obnoxious and inappropriate. It would be like driving down an icy curvy highway, seeing movement … maybe a deer …. off ahead and to the side, and down shifting, and then having the transmission override your decision or stop to ask you if you really mean to do that, and you fail to maintain control of the vehicle, the deer runs out in front of you and you can’t safely swerve and wack!!!! Bambi is dead!!! Killing Bambi with your operating system is not acceptable.
Having said all that, wouldn’t it be nice to have Linux “remove” your command line deleted files to the trash can? Well, it depends.
There is a KDE based command (it probably works in gnome too) for moving stuff to the trash can and later manipulating the trash can here. However, in my humble opinion it is flawed. I could be wrong (comments welcome). For one thing, the commands that is requires are different from one another (ImageMagick style). To throw something out you invoke ‘trash’ but to list what is in the trash can you invoke ‘list-trash’.
I would prefer to see all the commands be “trash” with switches, and/or to have all the commands start with ‘trash’ … so you could have:
trash – copies a file to the trash can
trash-list – lists the contents of the trash can
trash-restore foo – restores foo
and so on.
But there may be an even better way to do all of this. With simple knowledge. Know that, for instance, in gnome (and probably other desktops) the “trash” is located in a directory inside your home directory, here:
The dot at the beginning makes the folder invisible, but it is there, in your home directory. Go to your home directory in a terminal and type in “cd .Trash” followed by “ls” and you’ll see all of your dirty laundry right there.
So when you really don’t want to throw stuff out, throw it in the trashcan instead. For instance, copy it to the trash, then delete it in place.
The cited utility for a command line trash may be useful, but I would strongly urge you to NOT do one thing recommended on their web site: To create an alias so that “rm” invokes this utility. rm is the “remove” command (delete) in Linux. If the standard delete command becomes the ‘move to trash’ facility, and you write a script that creates and then clobbers a zillion files, you may have problems. The reason for having a trash can is so that you, the user, can go rooting around in it for stuff you accidentally threw away. You don’t want the entire waste stream of your computer system dumping everything in there. That would be like hooking your sewer outlet to the trash can in your kitchen. You would not want to go in there looking for the coupon you accidentally threw out with the junk mail…