By default, the UNIX utilities
do what you tell them to without asking.
If that means overwriting existing files or deleting all the files
in the directory, they'll do it.
If you want more safety, you can add aliases like these to your
shell startup files (
alias rm /bin/rm -i alias rm='/bin/rm -i'
alias cp /bin/cp -i alias cp='/bin/cp -i'
alias mv /bin/mv -i alias mv='/bin/mv -i'
may be different on your system.
You may be able to omit it completely, but watch out for alias loops if
Then, when you type
at the command line,
the command will prompt you before destroying an existing file.
command will always prompt you before every file
you ask it to remove (with a wildcard, this can take some time!).
These aliases set the
(interactive) option; most versions of
The GNU versions of
They also have an alternative: the
option, which automatically
makes a backup of any file that will be overwritten.
These aliases can be dangerous when you
If you change to a new shell or use another account without these
aliases, you can destroy files before you realize that the aliases
aren't there to protect you.
So, I don't use any of these aliases on my account.
Instead, I check what I type before I press RETURN.
You can override the alias by typing:
command rm *.o