Simplify Disk Space Analysis with TopNDiskAnalyzer

Simplify Disk Space Analysis with TopNDiskAnalyzer



3 min read


Managing and understanding file sizes within a directory is a common task for developers, sysadmins, sre, and users. To simplify this process, I've created a tool called TopNDiskAnalyzer. This tool allows users to analyze and retrieve the top N files and folders based on their sizes within a specified directory.


  1. Concurrent Processing

TopNDiskAnalyzer leverages concurrent processing to efficiently analyze files and folders concurrently. This is achieved by utilizing goroutines in Go, ensuring optimal performance, especially when dealing with large directory structures.

  1. Dynamic Top N

One notable feature of TopNDiskAnalyzer is its ability to dynamically set the 'N' value for the top files and folders. Users can provide the desired count using the --top command-line argument. If not specified, the default value is 10.

  1. Informative Output

The tool produces insightful output, displaying the top files and folders along with their sizes in a human-readable format. The sizes are presented in KB, MB, GB, etc., making it easy for users to comprehend.

Getting Started


Download Binary

You can download the precompiled binary for your operating system from the releases page.

# 64-bit
wget -O tdf
chmod +x tdf
sudo mv tdf /usr/local/bin/

# 32-bit
wget -O tdf
chmod +x tdf
sudo mv tdf /usr/local/bin/
# 64-bit
wget -O tdf
chmod +x tdf
sudo mv tdf /usr/local/bin/

Download the tdf.exe from the releases page.

Build from Source

If you prefer to build from a source, make sure you have Go installed. Clone the repository and run the following commands:

git clone
cd TopNDiskAnalyzer
go build -o tdf main.go
sudo mv tdf /usr/local/bin/

This will provide users with clear instructions on how to download and install your TopNDiskAnalyzer tool on various operating systems.


Once installed, you can use the tool by running the following command:

tdf [options] [directory_path]


  • --dir: Specifies the directory path. Defaults to the current directory.

  • --top: Specifies the number of top items to display. Defaults to 10.

  • --help: Displays helpful information about the program and its options.

The command recursively analyzes the specified directory, calculating the sizes of files and folders, and then displays the top items based on their sizes in descending order.


# Analyze the current directory, display top 10 items

# Analyze a specific directory, display top 15 items
tdf --top 15 /path/to/directory 

# Analyze a specific directory (using positional argument), display top 10 items
tdf /path/to/directory

# Help
tdf --help


Here are some screenshots illustrating the usage of TopNDiskAnalyzer:

  1. Help Command

  2. Relative Path

  3. Absolute Path

  4. Top Option


TopNDiskAnalyzer provides a straightforward solution for users who need quick insights into the largest files and folders within a directory. Its concurrent processing, dynamic top N feature, and informative output make it a valuable tool for various use cases.

To get started, check out the GitHub repository and feel free to contribute or provide feedback.

🙏Thank you for reading...

✈️ Linkedin: