Mac中安全地使用rm命令
- 2019 年 12 月 20 日
- 筆記
.example_responsive_1 { width: 200px; height: 50px; } @media(min-width: 290px) { .example_responsive_1 { width: 270px; height: 50px; } } @media(min-width: 370px) { .example_responsive_1 { width: 339px; height: 50px; } } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 50px; } } @media(min-width: 720px) { .example_responsive_1 { width: 655px; height: 50px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 50px; } } (adsbygoogle = window.adsbygoogle || []).push({});
Mac中安全地使用rm命令
目錄
讓rm命令將文件(夾)移入廢紙簍, 安全地刪除文件. 文章地址: https://blog.piaoruiqing.com/2019/06/27/make-rm-safe-on-mac/
關鍵詞
rm
: 刪除命令, 文件一旦通過rm命令刪除, 則無法恢復, 所以必須格外小心地使用該命令.trash
: OSX下的小型命令行程序, 用於將文件或文件夾移動到廢紙簍.
關鍵詞
rm
: 刪除命令, 文件一旦通過rm命令刪除, 則無法恢復, 所以必須格外小心地使用該命令.trash
: OSX下的小型命令行程序, 用於將文件或文件夾移動到廢紙簍.
前言
終端操作中經常會使用到rm
甚至rm -rf
命令刪除一些文件, 這種方式刪除的文件不會出現在廢紙簍中, 若出現誤刪的情況, 找迴文件是個麻煩事. 所以需要改變rm
命令, 讓它將文件移入廢紙簍.
終端中如何將文件移入回收站
trash is a small command-line program for OS X that moves files or folders to the trash.
trash
命令可以實現將文件(夾)移入廢紙簍, 並且支持指定使用-F
指定使用Finder來刪除文件(這種方式支持放回原處操作)
安裝trash
命令
$ brew install trash $ trash -F [file-name]
如果沒有安brew
, 安裝參考官網即可: https://brew.sh
將rm
設置為trash
命令的別名
打開~/.bash_profile
文件, 並添加一行alias rm="trash -F"
, 重新打開終端即可生效 (也可執行source ~/.bash_profile
使配置生效).
alias rm="trash -F"
參考文獻
© 2019, 朴瑞卿.
[版權聲明] 本文發佈於朴瑞卿的博客, 允許非商業用途轉載, 但轉載必須保留原作者朴瑞卿 及鏈接:https://blog.piaoruiqing.com. 如有授權方面的協商或合作, 請聯繫郵箱: [email protected].