If using the tcsh shell, you can set the rmstar variable for that:
tcsh> set rmstar
tcsh> touch file
tcsh> rm *
Do you really want to delete all files? [N/y]
That however doesn't apply to
tcsh> rm ./*
tcsh>
Too bad, as rm ./* is really what you should be doing. rm * is unsafe because it doesn't work if there are files whose name starts with -.
zsh adapted and improved that tcsh feature and made it the default:
zsh$ rm ./*
zsh: sure you want to delete the only file in /home/chazelas/. [yn]?
zsh$ rm foo /*
zsh: sure you want to delete all 33 files in / [yn]?
(note that it happens before rm is even involved. Above foo is not deleted until you press y).
You can disable it with
set -o rmstarsilent
There's even a rmstarwait option for the trigger-happy users:
RM_STAR_WAIT:
If querying the user before executing 'rm ' or 'rm path/', first
wait ten seconds and ignore anything typed in that time. This
avoids the problem of reflexively answering 'yes' to the query when
one didn't really mean it. The wait and query can always be
avoided by expanding the '*' in ZLE (with tab).
Another way to bypass that check is to use rm ./**.
rm. You answer lies within. – glenn jackman Nov 12 '18 at 18:19rmwith the "safety option" -- you'll get used to the safety new, and then get burned when you move to another system that does not have that alias. – glenn jackman Nov 12 '18 at 18:21