一些 linux 命令行神器

htop

glances

htop的替代

ncdu

查文件夹大小

一层层的 du,一层层的 cd,整个过程就像刨垃圾堆一样的恶心

dstat

alias dstat='dstat -cdlmnpsy'

iotop

列正在写的进程

Total DISK READ : 0.00 B/s | Total DISK WRITE :    39.48 K/s
Actual DISK READ: 0.00 B/s | Actual DISK WRITE:       0.00 B/s
  PID  PRIO  USER     DISK READ DISK WRITE>  SWAPIN      IO    COMMAND
12345 be/4 root          0.00 B    124.00 K  0.00 %  0.00 % python server.py
12346 be/4 root          0.00 B    100.00 K  0.00 %  0.00 % python server.py
iotop -o -P -a
-o, --only
       Only  show  processes  or threads actually doing I/O, instead of showing all processes or threads.
       This can be dynamically toggled by pressing o.
-P, --processes
       Only show processes. Normally iotop shows all threads.
-a, --accumulated
       Show accumulated I/O instead of bandwidth. In this mode, iotop shows the amount of  I/O  processes
       have done since iotop started.

lsof

列正在写的文件

lsof  | grep 'w\s*REG'

ag

比grep、ack更快的递归搜索文件内容

fuck

https://github.com/nvbn/thefuck

每次命令行打错了以后,打一句fuck就会自动更正命令。比如apt-get打成了aptget。fuck以后自动变成apt-get。但还是没加sudo。再fuck,成功!

又比如git branch打成了git brnch。fuck!更正成git branch

又比如python打成了puthon。fuck!一秒变python

而且关键是每次打命令和内心os完全一致,有种人机合一的快感。fuck!