Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

Show running processes ordered by memory consumption

ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r
https://snipt.net/embed/39142bfb27891242243d3356d7ca234a/
https://snipt.net/raw/39142bfb27891242243d3356d7ca234a/
39142bfb27891242243d3356d7ca234a
bash
Bash
1
2016-12-07T12:03:57
True
False
False
/api/public/snipt/14906/
show-running-processes-ordered-by-memory-consumption
<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>ps -eo pmem,pcpu,rss,vsize,args <span class="p">|</span> sort -k <span class="m">1</span> -r </span></pre></div> </td></tr></table>
bash, memory, ps, sort

Bash

Check apache memory consumption

ps aux | egrep ^apache | awk 'BEGIN {x=0} {x+=$4} END {print x}'
https://snipt.net/embed/d2fdfbf1c930bae5963a7d27081d0c8e/
https://snipt.net/raw/d2fdfbf1c930bae5963a7d27081d0c8e/
d2fdfbf1c930bae5963a7d27081d0c8e
bash
Bash
1
2016-12-10T00:00:28
True
False
False
/api/public/snipt/14568/
check-apache-memory-consumption
<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>ps aux <span class="p">|</span> egrep ^apache <span class="p">|</span> awk <span class="s1">&#39;BEGIN {x=0} {x+=$4} END {print x}&#39;</span> </span></pre></div> </td></tr></table>
apache, awk, dv, egrep, memory, ps

Bash

Show the number of processes owned by each user on the system

ps aux | awk '{$1} {++P[$1]} END {for(a in P) if (a != "USER") print a, P[a]}' | column -t
https://snipt.net/embed/fcc9fc246098e37e7dd8488127102b95/
https://snipt.net/raw/fcc9fc246098e37e7dd8488127102b95/
fcc9fc246098e37e7dd8488127102b95
bash
Bash
1
2016-12-10T07:43:02
True
False
False
/api/public/snipt/14360/
show-the-number-of-processes-owned-by-each-user-on-the-system
<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>ps aux <span class="p">|</span> awk <span class="s1">&#39;{$1} {++P[$1]} END {for(a in P) if (a != &quot;USER&quot;) print a, P[a]}&#39;</span> <span class="p">|</span> column -t </span></pre></div> </td></tr></table>
awk, bash, ps

Text only

AD User group list

(Get-QADUser user).memberOf | Get-QADGroup | select name
https://snipt.net/embed/37b83fc3256a6590e3fb749e239ef63b/
https://snipt.net/raw/37b83fc3256a6590e3fb749e239ef63b/
37b83fc3256a6590e3fb749e239ef63b
text
Text only
1
2016-12-09T09:11:44
True
False
False
/api/public/snipt/11762/
ad-user-group-list
<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>(Get-QADUser user).memberOf | Get-QADGroup | select name </span></pre></div> </td></tr></table>
ad, ps

Bash

Find out the top 10 resources consuming processes

1
2
3
4
5
# memory consuming processes
ps -auxf | sort -nr -k 4 | head -10

# CPU consuming processes
ps -auxf | sort -nr -k 3 | head -10
https://snipt.net/embed/eaf9dc7e2993ffecb8a27cc06bbfbdc7/
https://snipt.net/raw/eaf9dc7e2993ffecb8a27cc06bbfbdc7/
eaf9dc7e2993ffecb8a27cc06bbfbdc7
bash
Bash
5
2016-12-10T02:41:57
True
False
False
/api/public/snipt/9291/
find-out-the-top-10-resources-consuming-processes
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># memory consuming processes</span> </span><span id="L-2"><a name="L-2"></a>ps -auxf <span class="p">|</span> sort -nr -k <span class="m">4</span> <span class="p">|</span> head -10 </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># CPU consuming processes</span> </span><span id="L-5"><a name="L-5"></a>ps -auxf <span class="p">|</span> sort -nr -k <span class="m">3</span> <span class="p">|</span> head -10 </span></pre></div> </td></tr></table>
bash, cpu, head, memory, ps, sort

Bash

watch a find/rm in action as it moves through thousands of files

watch -n .5 "ps auxwwf | egrep 'find|rm'"
https://snipt.net/embed/0fb151c68fa9f5bebb586a5bc129fb30/
https://snipt.net/raw/0fb151c68fa9f5bebb586a5bc129fb30/
0fb151c68fa9f5bebb586a5bc129fb30
bash
Bash
1
2016-12-07T14:16:30
True
False
False
/api/public/snipt/8390/
watch-a-findrm-in-action-as-it-moves-through-thousands-of-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>watch -n .5 <span class="s2">&quot;ps auxwwf | egrep &#39;find|rm&#39;&quot;</span> </span></pre></div> </td></tr></table>
auxwwf, egrep, find, ps, rm, watch

Bash

Show processes sorted by RSS (resident set size)

ps -e -orss=,pid=,args= | sort -b -k1,1n | pr -TW$COLUMNS
https://snipt.net/embed/81842f43c1ce9bd8a79c60d22078c2a7/
https://snipt.net/raw/81842f43c1ce9bd8a79c60d22078c2a7/
81842f43c1ce9bd8a79c60d22078c2a7
bash
Bash
1
2016-12-10T07:42:55
True
False
False
/api/public/snipt/5010/
show-processes-sorted-by-rss-resident-set-size
<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>ps -e -orss<span class="o">=</span>,pid<span class="o">=</span>,args<span class="o">=</span> <span class="p">|</span> sort -b -k1,1n <span class="p">|</span> pr -TW<span class="nv">$COLUMNS</span> </span></pre></div> </td></tr></table>
bash, pid, pr, ps, rss, sort

Bash

Show user's own processes only

ps -U `whoami` -u `whoami` uf
https://snipt.net/embed/b85981d4ed469f90e4a0dfb807acb4fc/
https://snipt.net/raw/b85981d4ed469f90e4a0dfb807acb4fc/
b85981d4ed469f90e4a0dfb807acb4fc
bash
Bash
1
2016-12-09T12:48:25
True
False
False
/api/public/snipt/4955/
show-users-own-processes-only
<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>ps -U <span class="sb">`</span>whoami<span class="sb">`</span> -u <span class="sb">`</span>whoami<span class="sb">`</span> uf </span></pre></div> </td></tr></table>
bash, ps, whoami
Copyrighted, illegal, or inappropriate content? Email [email protected].