I’m scared that one day, I’m going to put a space or miss out something in the command I currently use:
rm -rf ./*
Is there a safer way of emptying the current directory’s contents?
Advertisement
Answer
The safest way is to sit on your hands before pressing Enter.
That aside, you could create an alias like this one (for Bash)
alias rm="pwd;read;rm"
That will show you your directory, wait for an enter press and then remove what you specified with the proper flags. You can cancel by pressing ^C instead of Enter.