一、引言
前幾天發現rm刪除文件后文件找不回來了,上網找辦法發現都很麻煩。
於是我alias rm='rm -i'這樣每次刪除都會詢問我。但是我是個急性子根本不管直接y,遇到文件夾時都要崩潰了,所以在刪文件夾時直接-rf。
又於是誤刪操作還是時有發生。
二、問題解決
ubuntu的桌面上有個垃圾桶圖標

何不利用起來,於是發現了gio命令
Trash在~/.local/share/Trash
gio trash [files] 將文件移動到垃圾桶
恢復只能手動恢復,路徑在~/.local/share/Trash/info中
Usage:
gio COMMAND [ARGS…]
Commands:
help Print help
version Print version
cat Concatenate files to standard output
copy Copy one or more files
info Show information about locations
list List the contents of locations
mime Get or set the handler for a mimetype
mkdir Create directories
monitor Monitor files and directories for changes
mount Mount or unmount the locations
move Move one or more files
open Open files with the default application
rename Rename a file
remove Delete one or more files
save Read from standard input and save
set Set a file attribute
trash Move files or directories to the trash
tree Lists the contents of locations in a tree
Use “gio help COMMAND” to get detailed help.
之后的事情簡單起來了alias gt='gio trash'
