ubuntu中的垃圾桶(trash)的使用


一、引言
前幾天發現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'


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM