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

一、引言
前几天发现rm删除文件后文件找不回来了,上网找办法发现都很麻烦。
于是我alias rm='rm -i'这样每次删除都会询问我。但是我是个急性子根本不管直接y,遇到文件夹时都要崩溃了,所以在删文件夹时直接-rf。
又于是误删操作还是时有发生。

二、问题解决
ubuntu的桌面上有个垃圾桶图标
ubuntu中的垃圾桶(trash)的使用
何不利用起来,于是发现了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 gio trash='gt'
bash: alias: gio trash': invalid alias name
才发现trash时command字段,将就用吧

上一篇:Shell-alias在Shell脚本中的使用


下一篇:git常用命令