I have a rm
aliased:
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?
I have a rm
aliased:
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?
You can suppress the alias by escaping or quoting the command name, e.g.,
\rm foo
"rm" foo
Further reading:
With rm
, -f
overrides -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
.
e.g.
$ 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).
rm
, the-f
flag overrides a previous-i
flag; so you can simply add-f
to the (aliased) command – steeldriver Apr 29 '16 at 01:41