I have a
alias rm='rm -i'
How can I override the
-i option when I want to remove a large number of files and I don't want to confirm each deletion?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You can suppress the alias by escaping or quoting the command name, e.g.,
\rm foo "rm" foo
-i if it comes later on the command line.
Whichever option comes last on the command line will have effect, so you can override an
alias rm='rm -i' just by using
rm -f, which will expand to
rm -i -f.
$ mkdir rmtest $ cd rmtest $ touch a b c d e f $ alias rm='rm -i' $ rm * rm: remove regular empty file 'a'? n rm: remove regular empty file 'b'? n rm: remove regular empty file 'c'? n rm: remove regular empty file 'd'? n rm: remove regular empty file 'e'? n rm: remove regular empty file 'f'? n $ rm -f * $ ls -l total 0 $
rm -f -i will, of course, still prompt you for each file to be deleted.
(this is true for at least GNU
rm. haven't tested with other versions).