15 October 2005 2 comments Linux
This blog post is 17 years old! Most likely, its content is outdated. Especially if it's technical.
In years I haven't accidentally deleted important stuff with rm *
when what I mean is rm *~
to delete backup files, until...
Yesterday I accidentally deleted all templates for a work project when I wanted to delete the backup files which look like this foo.zpt~
. In the haste I did:
When I meant:
Today I did it again. I didn't want any backup files in my ~/bin
directory which just screws up tab completion. Again, in the haste I accidentally deleted all my bin scripts :( Most of it recoverable or easily rewritable but still a f**ing nuisance. What to do? Do people have any good suggestions to make the rm
work more like the Trash can does on the desktop?
- Previous:
- table-layout: fixed 13 October 2005
- Next:
- Playing with Reverend Bayesian 19 October 2005
- Related by category:
- Linux tip: du --max-depth=1 27 September 2007 Linux
- How to create-react-app with Docker 17 November 2017 Linux
- Be very careful with your add_header in Nginx! You might make your site insecure 11 February 2018 Linux
- set -ex - The most useful bash trick of the year 31 August 2014 Linux
- Run something forever in bash until you want to stop it 13 February 2018 Linux
- Related by keyword:
- File check before delete 7 March 2008
- Running simple SQL commands on the command line 8 January 2005
- Mvbackupfiles - a script to "delete" back autosaved backup files 24 November 2005
Add an alias in your shell config (if it supports aliases that is) so that 'rm' always asks you before any deletion. You can always override with -f if you don't want to answer any questions ...
alias rm='rm -i'
-i, --interactive prompt before any removal
Instruct your editor to put those backup files in the system tmp directory, set up your system to clean up there with the "daily" cron job. Everything that gets you to routinely type dangerous stuff should be eliminated.