查看句柄数

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
$ ulimit -a
Maximum size of core files created                           (kB, -c) 0
Maximum size of a process’s data segment                     (kB, -d) unlimited
Maximum size of files created by the shell                   (kB, -f) unlimited
Maximum size that may be locked into memory                  (kB, -l) unlimited
Maximum resident set size                                    (kB, -m) unlimited
Maximum number of open file descriptors                          (-n) 256
Maximum stack size                                           (kB, -s) 8192
Maximum amount of cpu time in seconds                   (seconds, -t) unlimited
Maximum number of processes available to a single user           (-u) 2784
Maximum amount of virtual memory available to the shell      (kB, -v) unlimited

查看打开句柄总数

1
lsof|awk '{print $2}'|wc -l

根据打开文件句柄的数量降序排列

1
lsof|awk '{print $2}'|sort|uniq -c|sort -nr|more