Skip to main content

Find the 10 largest directories on POSIX

This script outputs the number of 1,024 byte blocks consumed by each of the 10 largest directories in the provided directory, or in the current directory if no arguments are provided.

From: Warren Young
Date: Wed, 30 Jan 2013 21:08:33 -0700

"This script helps me find the 10 biggest pigs on any system with a basic POSIX user environment."

#!/bin/sh

if [ $# -eq 0 ]
then
    dir=.
else
    if [ ! -d $1 ]
    then
        echo usage: $0 [directory] [options]
        echo
        echo "  Prints kb in use in directory; if directory isn't"
        echo "  given, '.' is assumed."
        echo
        echo "  If you give options, they are passed to du, in addition"
        echo "  to the -sk options the script provides."
        echo
        exit
    fi
    dir=$1
fi
echo -n Hang on, finding pigs in
if [ $dir = . ]
then
    echo " current directory..."
else
    echo " \"$dir\"..."
fi
du -skx $2 $dir/* | sort -rn | head -10


Post a Comment

Popular posts from this blog

Running 2560x1080 on LG 29UM57-P on an old MacBook Pro OSX El Capitan

Yes. A mid-2011 MacBook Pro running OSX El Capitan can drive a 2560x1080 monitor via HDMI.
I was not able to get 60 Hz working. I am settling with 53 Hz. I tried many settings before finding something that works. The refresh rate seems fine to me. Maybe the text could be clearer but for a $200 monitor running this resolution, I'll take it. Apple MacBook 2015 retina resolution is 2560 x 1800. Consider buying a better monitor that may literally give you fewer headaches. Install SwitchResXFollow the instructions for disabling SIPAfter rebooting, run SwitchResX via System PreferencesSelect your LG monitorClick Custom ResolutionsClick the + icon Enter these settings (source)Exit SwitchResX and saveRebootRun SwitchResX via System PreferencesSelect your LG monitorClick Current ResolutionsSelect the 2560x1080, 53 Hz settingEnable SIPIf you discover better settings, please leave a comment.

Collecting and graphing metrics via Apache Camel, Statsd, and Graphite

If you're curious about Apache Camel's metrics reporting via Dropwizard, this guide will help you get Graphite running in a Docker container. Then you will run an instrumented Camel application and view its metrics via Graphite's browser UI.

(1) Install Docker

There are many ways to do this depending on your platform. Google it.

(2) Install and run the Docker container for Statsd and Graphite

Refer to https://github.com/hopsoft/docker-graphite-statsd

The instructions infer that you can run the container without specifying port mappings. This is plain wrong. So use the following command to start the container:

docker run -d --name graphite --restart=always -p 80:80 -p 8125:8125/udp hopsoft/graphite-statsd It is not necessary to enable Graphite's UDP listener. Statsd receives metrics via UDP and forwards them to Graphite over TCP. (3) On Windows and OSX, determine the IP address of the graphite Docker container

On Linux, you can use localhost.

On Windows and OSX, there are…

Silver City New Mexico November 2017

I don't take enough photos for compelling albums. I was once an amateur photographer with film cameras. Now I respect others’ privacy. I think our society has overdone it since everyone has a camera. Instead, I take mental pictures by talking to the locals in order to understand what I'm seeing in a historical dimension. It took me my whole life so far to see the invisible which is beautiful in its own right.

Photos
The frontier is alive and well in New Mexico. Silver City is where large-scale cattle ranching was attempted, start-up style, in the 19th century by venture capitalists. All of the operations went bankrupt due to drought. This was the approximate location of the television show Bonanza. The place looks exactly the same. Time has stood still.
If you want to buy a ranch, I know a place. It's amazing. But water is a problem.
Silver City is probably the most egalitarian city in the US. Although small, the government obviously has the typical jobs such as judge and p…