4 ms·
Tangential: another safeguard you can adopt is avoiding "hard delete" commands like rm and find -delete. Untrain yourself from these commands by never using the
by nothrabannosir 7y ago
Tangential: another safeguard you can adopt is avoiding "hard delete" commands like rm and find -delete. Untrain yourself from these commands by never using them. On Mac systems, the "trash" program (brew install trash) sends files to your system trash. You can use `trash [file]` and `find .. -print0 | xargs -0 trash --`. rm is a dangerous command you should only very rarely be using.
I fish something out of the trash a few times a year and lemme tell ya; it's worth the investment.
Another tip if you fancy debugging shells is using
python -c "print(__import__('sys').argv[1:])" sample "arg here" * foo
this provides the same functionality as the c program in TFA, without needing gcc.
- icebraining 7y agoTrash is the poor man's backup system.
- JulianWasTaken 7y agoYou use trash and backups. Rich men can still save a few dollars for pocket change.
- Cpoll 7y agoI learned from a sysadmin to use `mv` instead of `rm` when you're removing potentially critical files. Other tips include colouring your prompt highlighted red on production boxes so you never accidentally think you're somewhere safe. Nowadays I try to avoid SSHing into mission critical machines though.
- rezonant 7y ago> this provides the same functionality as the c program in TFA, without needing gcc. or just using bash: function showargs() { for x in "$@"; do echo "arg: $x"; done }
- mkl 7y agoI like it. I'm using a numbered version: function showargs() { i=1; for x in "$@"; do echo "arg $((i++)): $x"; done }
- heinrichhartman 7y agoNo need for python, this works just as good: printf ":%s:" *foo