Background
<p dir="auto">For a long time, I've been looking for somewhere to post a small number of bash scripts I've borrowed/hacked from various places online, and Steemit seems to be the most natural place to create a repository of short, but useful scripts that I use on a daily basis.
<h3>Today's Script
<p dir="auto">This script lists the top 20 directories from your current directory downwards, in terms of size.
<p dir="auto">Why might this be important?
<p dir="auto">Simple answer: if you manage/own a hard drive or web server (I manage a few VPS servers), then you want a <em>quick way to see which directories have become bloated, and delete unwanted files accordingly.
<p dir="auto">Webservers can particularly get full, quickly, if there are various backup scripts running.
<h3>Here's the Script:
<pre><code>du -h . | sort -nr| grep [0-9]M | head -20<br />
<p dir="auto">Normally, I'll put this into a file in /usr/local/bin, as follows:
<pre><code>sudo echo "du -h . | sort -nr| grep [0-9]M | head -20" > /usr/local/bin/whatsup<br />
<br />
sudo chmod +x $!
<p dir="auto">The above commands enable me to use this command:
<pre><code><strong>whatsup
<p dir="auto">...to list those top 20 offending bloated directories.
<p dir="auto">So there you go: a simple script to quickly enable me to track down bloated directories, so I can then dive in, and remove backup files that haven't yet been deleted automatically.
<p dir="auto">Hope that helps!
<p dir="auto">Dez.
<h3>Author BIO
<p dir="auto">Dez Futak is a serial entrepreneur who helps local businesses & individuals increase their cashflow. For more details, see the Services menu at <a href="https://dezfutak.com" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">DezFutak.com
Congratulations @dezfutak! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
<p dir="auto"><a href="http://steemitboard.com/@dezfutak" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link"><img src="https://images.hive.blog/768x0/https://steemitimages.com/70x80/http://steemitboard.com/notifications/firstpayout.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/70x80/http://steemitboard.com/notifications/firstpayout.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/70x80/http://steemitboard.com/notifications/firstpayout.png 2x" /> You got your First payout <p dir="auto">Click on any badge to view your own Board of Honor on SteemitBoard.<br /> For more information about SteemitBoard, click <a href="https://steemit.com/@steemitboard" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">here <p dir="auto">If you no longer want to receive notifications, reply to this comment with the word <code>STOP <blockquote> <p dir="auto">Upvote this notification to help all Steemit users. Learn why <a href="https://steemit.com/steemitboard/@steemitboard/http-i-cubeupload-com-7ciqeo-png" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">here!