Oneliners: Difference between revisions

From fakedWiki
Jump to: navigation, search
(Created page with "=== MySQL === Get the "hit rate" percentage of Connections vs. Threads_created, helps you with finding the sweet spot for thread_cache_size (the closer to 100%, the better): <...")
 
No edit summary
Line 3: Line 3:
<pre>
<pre>
echo "scale=4; 100-`mysql -NB -e "SHOW STATUS LIKE 'Threads_created'; SHOW STATUS LIKE 'Connections';" | awk '{print $2}' | tr '\n' '/'`100" | bc
echo "scale=4; 100-`mysql -NB -e "SHOW STATUS LIKE 'Threads_created'; SHOW STATUS LIKE 'Connections';" | awk '{print $2}' | tr '\n' '/'`100" | bc
</pre>
=== Filesystem ===
Get the size of the a folder and it's subdirectories, sorted by size:
<pre>
du --max-depth=1 -k /path/to/folder | sort -nr | cut -f2 | xargs -d '\n' du -sh
</pre>
</pre>

Revision as of 15:33, 8 November 2013

MySQL

Get the "hit rate" percentage of Connections vs. Threads_created, helps you with finding the sweet spot for thread_cache_size (the closer to 100%, the better):

echo "scale=4; 100-`mysql -NB -e "SHOW STATUS LIKE 'Threads_created'; SHOW STATUS LIKE 'Connections';" | awk '{print $2}' | tr '\n' '/'`100" | bc

Filesystem

Get the size of the a folder and it's subdirectories, sorted by size:

du --max-depth=1 -k /path/to/folder | sort -nr | cut -f2 | xargs -d '\n' du -sh