snipt

Ctrl+h for KB shortcuts

Bash

number of file open by command

lsof | awk '{printf("%s\n",$1)}' | sort | uniq -c | sort -n
https://snipt.net/embed/75ca64e0793a44cbe1d4ec8120e4a6d7/
/raw/75ca64e0793a44cbe1d4ec8120e4a6d7/
75ca64e0793a44cbe1d4ec8120e4a6d7
bash
Bash
2
2019-07-17T17:54:27
True
False
False
/api/public/snipt/12772/
number-of-file-open-by-command
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>lsof <span class="p">|</span> awk <span class="s1">&#39;{printf(&quot;%s\n&quot;,$1)}&#39;</span> <span class="p">|</span> sort <span class="p">|</span> uniq -c <span class="p">|</span> sort -n </span></pre></div> </td></tr></table>
awk, bash, files, lsof, sh, sort, uniq

Bash

list open files

lsof | awk '{print $1}' | sort | uniq -c
https://snipt.net/embed/1dedbcdd190d2a1ba9774ea539da5dfa/
/raw/1dedbcdd190d2a1ba9774ea539da5dfa/
1dedbcdd190d2a1ba9774ea539da5dfa
bash
Bash
1
2019-07-21T03:01:52
True
False
False
/api/public/snipt/7310/
list-open-files-1
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>lsof <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span> <span class="p">|</span> sort <span class="p">|</span> uniq -c </span></pre></div> </td></tr></table>
linux, lsof, server

Bash

amount of file handlers | ? | total allowed

cat /proc/sys/fs/file-nr 
https://snipt.net/embed/2fb96ee8630083b72c9477822d161540/
/raw/2fb96ee8630083b72c9477822d161540/
2fb96ee8630083b72c9477822d161540
bash
Bash
1
2019-07-19T18:25:19
True
False
False
/api/public/snipt/6447/
amount-of-file-handlers-total-allowed
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>cat /proc/sys/fs/file-nr </span></pre></div> </td></tr></table>
bash, files, list, lsof, of, open

Bash

max for lsof

cat /proc/sys/fs/file-max 
https://snipt.net/embed/2c971c605eb1597ba0413e38ca4fa8ee/
/raw/2c971c605eb1597ba0413e38ca4fa8ee/
2c971c605eb1597ba0413e38ca4fa8ee
bash
Bash
1
2019-07-19T02:11:05
True
False
False
/api/public/snipt/6446/
max-for-lsof
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>cat /proc/sys/fs/file-max </span></pre></div> </td></tr></table>
bash, files, list, lsof, open

Bash

list open files

lsof | awk '{print $1}' | sort | uniq -c
https://snipt.net/embed/02dc9fb5c844190160b7fc39c6fce2ee/
/raw/02dc9fb5c844190160b7fc39c6fce2ee/
02dc9fb5c844190160b7fc39c6fce2ee
bash
Bash
1
2019-07-18T16:49:29
True
False
False
/api/public/snipt/5975/
list-open-files
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>lsof <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span> <span class="p">|</span> sort <span class="p">|</span> uniq -c </span></pre></div> </td></tr></table>
files, lsof, numfile, open

Bash

See which ports are open

lsof -P | grep ':'
https://snipt.net/embed/cf656cf6f9bc20eeb5f746042c5699c0/
/raw/cf656cf6f9bc20eeb5f746042c5699c0/
cf656cf6f9bc20eeb5f746042c5699c0
bash
Bash
1
2019-07-18T22:58:01
True
False
False
/api/public/snipt/4324/
see-which-ports-are-open
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>lsof -P <span class="p">|</span> grep <span class="s1">&#39;:&#39;</span> </span></pre></div> </td></tr></table>
lsof, network, ports