1. find

  1. # find all executable files (exclude dir)
  2. find . -executable -type f -ls
  3. $ find . -executable -type f | xargs -r ls -al
  4. # find all files and sort by size and get the first 30 (-h means 'human readable')
  5. find . -type f -print0 | xargs -0 du -h | sort -rh | head -n 30

2. diff

  1. diff -y file1 file2 # -y is more readable
  2. # icdiff:分屏显示diff内容
  3. icdiff file-{a, b} #file-a file-b

3. 有用的小工具

3.1 pm: 在bash/zsh中迅速切换目录

  1. # 将你常去的目录添加到 pm 中,然后一条命令进行切换:
  2. cd projects/awesome-project
  3. pm add awesome-project
  4. # pm list 查看一下现在添加了哪些
  5. pm list
  6. # pm go + 名字,迅速切换到该目录
  7. pm go awesome-project
  8. # pm remove + 名字,进行删除

3.2 ncdu:可视化的空间分析程序

  1. # 一层层的du,一层层的cd, 太麻烦了

3.3 cppman:C++ 98/11/14 手册查询 for Linux/MacOS

  1. cppman std::thread

3.4 递归搜索文件内容,可替代grep, ack

  1. ag 'content to search'