{"id":2762,"date":"2008-06-17T15:24:14","date_gmt":"2008-06-17T15:24:14","guid":{"rendered":"http:\/\/scienceblogs.com\/gregladen\/2008\/06\/17\/talkin-trash-in-linux\/"},"modified":"2008-06-17T15:24:14","modified_gmt":"2008-06-17T15:24:14","slug":"talkin-trash-in-linux","status":"publish","type":"post","link":"https:\/\/gregladen.com\/blog\/2008\/06\/17\/talkin-trash-in-linux\/","title":{"rendered":"Talkin&#8217;Trash in Linux"},"content":{"rendered":"<p><span style=\"float: right; padding: 5px; width:250px\"><img decoding=\"async\" src=\"https:\/\/i0.wp.com\/scienceblogs.com\/gregladen\/wp-content\/blogs.dir\/472\/files\/2012\/04\/i-38f5e4d16e1655cf3be0bdf51c5bf72d-this_parrot_is_clobbered_linux.jpg?w=604\" alt=\"i-38f5e4d16e1655cf3be0bdf51c5bf72d-this_parrot_is_clobbered_linux.jpg\" data-recalc-dims=\"1\" \/><br \/> <center><em>  This file is clobbered&#8230; <\/em> <\/center><\/span>Linux and related operating systems are different from, say Windows, in many ways.  One is this:  When you &#8220;delete&#8221; a file in, say Windows, you are asked to confirm the operation, then the file is moved to the trash folder, not deleted.  In Linux, when you &#8220;delete&#8221; (remove) a file, it is clobbered.  Gone. It is a defunct entity.<!--more-->This might seem scary because what if you didn&#8217;t want to delete the file, or whatever?  Well, there are a lot of reasons that the &#8220;delete it without asking&#8221; philosophy is better than the &#8220;ask this dumb question again and again&#8221; philosophy.  We can fight about this if you want.  But I&#8217;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 &#8220;Are you sure you want to do this thing and are you sure you want to do that thing&#8221; every freakin&#8217; 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 &#8220;OK&#8221; to every single stupid question is much greater than the benefit of the occasional &#8220;oops&#8221; moment;2) Chances are, if you did not really want to delete the file, this is not because you pressed the &#8220;delete&#8221; 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:<CENTER><strong>Do you bla bla blaOK   Cancel<\/strong><\/CENTER>you are going to hit &#8220;OK&#8221; anyway.  And the file will be deleted anyway.3) Despite what I&#8217;ve said above, most\/many Linux desktop environments, such as gnome, have a &#8220;trash can&#8221; &#8230; so even though you are not being asked again and again &#8220;do you really want to delete this,&#8221; when you <em>do<\/em> 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 &#8230; maybe a deer &#8230;. 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&#8217;t safely swerve and wack!!!!  <em>Bambi is dead!!!<\/em>  Killing Bambi with your operating system is not acceptable.Having said all that, wouldn&#8217;t it be nice to have Linux &#8220;remove&#8221; 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 <a href=\"http:\/\/www.andreafrancia.it\/trash\/\">here.<\/a>  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 &#8216;trash&#8217; but to list what is in the trash can you invoke &#8216;list-trash&#8217;.I would prefer to see all the commands be &#8220;trash&#8221; with switches, and\/or to have all the commands start with &#8216;trash&#8217; &#8230; so you could have:trash    &#8211; copies a file to the trash cantrash-list &#8211; lists the contents of the trash cantrash-restore foo  &#8211; restores fooand 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 &#8220;trash&#8221; is located in a directory inside your home directory, here:.TrashThe 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 &#8220;cd  .Trash&#8221; followed by &#8220;ls&#8221; and you&#8217;ll see all of your dirty laundry right there.So when you really don&#8217;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 <a href=\"http:\/\/www.andreafrancia.it\/trash\/\">cited utility<\/a> 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 &#8220;rm&#8221; invokes this utility.  rm is the &#8220;remove&#8221; command (delete) in Linux.  If the standard delete command becomes the &#8216;move to trash&#8217; 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&#8217;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&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This file is clobbered&#8230; Linux and related operating systems are different from, say Windows, in many ways. One is this: When you &#8220;delete&#8221; a file in, say Windows, you are asked to confirm the operation, then the file is moved to the trash folder, not deleted. In Linux, when you &#8220;delete&#8221; (remove) a file, it &hellip; <a href=\"https:\/\/gregladen.com\/blog\/2008\/06\/17\/talkin-trash-in-linux\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Talkin&#8217;Trash in Linux<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"1","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[164,67,130,57],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p5fhV1-Iy","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/posts\/2762"}],"collection":[{"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/comments?post=2762"}],"version-history":[{"count":0,"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/posts\/2762\/revisions"}],"wp:attachment":[{"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/media?parent=2762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/categories?post=2762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gregladen.com\/blog\/wp-json\/wp\/v2\/tags?post=2762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}