Using mv instead of rm
The rm
command is dangerous. I have created an alias to use 2smvrm
instead of it. The command is in my ~/.bashrc
.
alias rm='mv --force -t ~/.local/share/trash '
The -t
option allows me to specify the target directory at the beginning of the command. The alias moves all the files specified to ~/.local/share/trash
. This means, if I change my mind at any time, I can pay the directory a visit.
If I really want to use rm
, I use /bin/rm
.
There are a lot of issues with the above command.
- If a file with the same name with the one I want to move has already exist, it will fail.
- The files might use a lot of space overtime. I thought of using the
/tmp/
directory since the os deletes file in there automatically.