From 14097f093c150382d6a369813764267bf8e48608 Mon Sep 17 00:00:00 2001 From: jonasbn Date: Fri, 9 Aug 2024 13:34:55 +0200 Subject: [PATCH] Initial revision of the oldest trick in the book --- rm/are_you_sure.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 rm/are_you_sure.md diff --git a/rm/are_you_sure.md b/rm/are_you_sure.md new file mode 100644 index 0000000..bdaa319 --- /dev/null +++ b/rm/are_you_sure.md @@ -0,0 +1,13 @@ +# Are You Sure? + +This might be the oldest trick I learned when I started using `rm` and `mv` on the command line on Linux ages ago. + +The trick is to use the `-i` option to `rm` and `mv` to make sure you are not deleting or moving the wrong files. + +```bash +alias rm='rm -i' +``` + +By creating an alias for `rm` you will be prompted for confirmation before deleting files, since the alias will let `rm` be replaced by `rm -i` which prompts for confirmation. + +The same pattern can be used for other commands and simple as it is it can be a lifesaver.