对危险操作进行别名配置

修改 ~/.bashrc 文件,适当位置加入以下代码:

# Alias configuration for dangerous operations
# 危险操作的别名配置
alias rm='rm -i'  # 删除文件前确认
alias mv='mv -i'  # 移动或覆盖文件前确认
alias cp='cp -i'  # 复制文件前确认
alias rmrf='echo "Are you sure you want to run rm -rf? (y/n)" && read answer && [ "$answer" = "y" ] && rm -rf'  # 递归删除前确认
alias overwrite='echo "Are you sure you want to overwrite the file? (y/n)" && read answer && [ "$answer" = "y" ] && >'  # 覆盖文件前确认
alias emptyfile='echo "Are you sure you want to empty the file? (y/n)" && read answer && [ "$answer" = "y" ] && : >'  # 清空文件前确认
alias exit='echo "Are you sure you want to exit? (y/n)" && read answer && [ "$answer" = "y" ] && exit'  # 退出终端前确认
alias reboot='echo "Are you sure you want to reboot the system? (y/n)" && read answer && [ "$answer" = "y" ] && reboot'  # 重启系统前确认
alias shutdown='echo "Are you sure you want to shutdown the system? (y/n)" && read answer && [ "$answer" = "y" ] && shutdown'  # 关机前确认
alias kill9='echo "Are you sure you want to kill the process? (y/n)" && read answer && [ "$answer" = "y" ] && kill -9'  # 强制终止进程前确认

然后运行:source ~/.bashrc

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇