Chris Maiorana: The Emacs Way: Deleting Files

Wait 5 sec.

I know it’s scary, but sometimes you have to delete files, and once they’re gone—they’re gone. I guess that was why GUI systems invented the trash folder. The trash is a safe place to store files you want to delete, just in case you made a mistake.In the UNIXy and Emacs worlds, once you delete that file, it’s gone, so you better have your story straight.UNIXy WayIn UNIXy world, you can delete files with the trusty rm (remove) command, as follows:rm file.txtrm -rf directory/Of course, once you have run that command, the file will be totally obliterated with no trace.While you should never do this, you should be aware of the dreaded nuclear solution to delete your whole filesystem from the root level:rm -rf /*Emacs WayThe Emacs way of deleting files will also obliterate files entirely, but with dired you get the added safety of marking files first with the d key. Once you have made your selections, you can use the x key to execute the deletion operationYou can also use capital D for immediate deletion.Likewise, if you wanted to run deletions interactively, you can run the functions directly:M-x delete-fileM-x delete-directorySo that’s how you can delete files using your command line, in UNIXy world, or your “dired” directory editor in Emacs.The post The Emacs Way: Deleting Files appeared first on Chris Maiorana.