rm 是Linux的文件删除命令,一旦误删文件,则很难恢复。
在生产环境中设置删除提示。
修改根目录下 .bashrc
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias rm='rm -i'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc p
添加 alias rm= ‘rm -i’
修改之后 运行:
source .bashrc
修改完成后 使用rm 删除单个文件会有确认提示。