Scan Your Linux Disk and Visualize It on Mac with GrandPerspective

Introduction

GrandPerspective is a useful disk space visualization tool for Mac. Have you ever wanted to scan files on Linux and visualize their disk usage with GrandPerspective? I created a Rust-based command-line tool called gpscan that sc…


This content originally appeared on DEV Community and was authored by kojix2

Introduction

GrandPerspective is a useful disk space visualization tool for Mac. Have you ever wanted to scan files on Linux and visualize their disk usage with GrandPerspective? I created a Rust-based command-line tool called gpscan that scans directories on Linux and generates GrandPerspective-compatible files.

https://github.com/kojix2/gpscan

Visualizing Disk Usage with GrandPerspective's Treemap

GrandPerspective is a disk usage visualization tool for Mac developed by Erwin Bonsma. It can be downloaded for free from SourceForge. (It is also available for purchase on the Mac App Store. If you'd like to support Erwin, feel free to buy it!)

https://grandperspectiv.sourceforge.net/

GrandPerspective Screenshot 1
GrandPerspective Screenshot 2

(Screenshots from the official website)

If you've used GrandPerspective before, you'll agree that this desktop application is visually appealing and operates quickly and smoothly. It's extremely helpful for identifying and organizing files that occupy large amounts of disk space.

The method of visualizing quantities using area on a plane is called a Treemap. GrandPerspective is not the only tool that visualizes disk usage with treemaps—similar tools are available for various operating systems.

How to Visualize Linux Disk Usage on Mac

However, visualizing disk usage on a Linux server and analyzing it on your Mac is not straightforward.

You might think using QDirStat on Linux would work, but Linux servers often lack desktop environments or Qt dependencies.

QDirStat comes with Perl scripts for scanning disks, but you still need QDirStat to visualize the results. There is a Mac version of QDirStat, but it doesn't match GrandPerspective in usability.

To solve this, I developed a simple command-line tool called gpscan, which scans directories on Linux and outputs files compatible with GrandPerspective.

Introducing the Command-line Tool gpscan

Overview

gpscan is a Rust-based command-line tool that outputs files compatible with Mac's GrandPerspective. You can download the output file to your local Mac and open it with GrandPerspective. This allows you to visualize storage usage and effectively identify and organize large files.

https://github.com/kojix2/gpscan

Prerequisites – Installing GrandPerspective

Install GrandPerspective using one of the following methods:

  1. Download from SourceForge
  2. Purchase from the Mac App Store
  3. Install via Homebrew:
   brew install grandperspective

Installing gpscan

Method 1: Download the Precompiled Binary

Download the executable from the GitHub Release and copy it to a directory in your system's PATH.

Method 2: Install via Rust's Cargo Package Manager

cargo install gpscan

How to Use gpscan

To scan your entire home directory, run the following commands:

cd ~/                        # Navigate to the home directory
gpscan ./ > result.gpscan    # Scan the current directory and save the results

The generated file (result.gpscan) is an XML file compatible with GrandPerspective. Use SFTP, SCP, Cyberduck, or similar tools to transfer it to your Mac.

Open the file (result.gpscan) with GrandPerspective on your Mac to visualize the directory's disk usage.

You can identify and manage old or unnecessary files by moving or deleting them to free up disk space.

Command-Line Options

  -o, --output <FILE>          Output file (default: stdout)
  -A, --apparent-size          Use apparent size instead of disk usage [false]
  -m, --mounts                 Cross filesystem boundaries during scan [false]
  -z, --include-zero-files     Include zero-byte files in scan [false]
  -e, --include-empty-folders  Include empty folders in scan [false]
  -q, --quiet                  Suppress all informational messages [false]
  -h, --help                   Print help
  -V, --version                Print version

Development and License

gpscan is licensed under the MIT License. However, most of the code and commit messages were generated with assistance from ChatGPT.

If you discover any bugs, feel free to submit an issue or pull request at https://github.com/kojix2/gpscan.

The original of this post was posted on Qiita and translated into English by ChatGPT. Thank you for reading. Have a good day.


This content originally appeared on DEV Community and was authored by kojix2


Print Share Comment Cite Upload Translate Updates
APA

kojix2 | Sciencx (2025-01-13T03:45:03+00:00) Scan Your Linux Disk and Visualize It on Mac with GrandPerspective. Retrieved from https://www.scien.cx/2025/01/13/scan-your-linux-disk-and-visualize-it-on-mac-with-grandperspective/

MLA
" » Scan Your Linux Disk and Visualize It on Mac with GrandPerspective." kojix2 | Sciencx - Monday January 13, 2025, https://www.scien.cx/2025/01/13/scan-your-linux-disk-and-visualize-it-on-mac-with-grandperspective/
HARVARD
kojix2 | Sciencx Monday January 13, 2025 » Scan Your Linux Disk and Visualize It on Mac with GrandPerspective., viewed ,<https://www.scien.cx/2025/01/13/scan-your-linux-disk-and-visualize-it-on-mac-with-grandperspective/>
VANCOUVER
kojix2 | Sciencx - » Scan Your Linux Disk and Visualize It on Mac with GrandPerspective. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/01/13/scan-your-linux-disk-and-visualize-it-on-mac-with-grandperspective/
CHICAGO
" » Scan Your Linux Disk and Visualize It on Mac with GrandPerspective." kojix2 | Sciencx - Accessed . https://www.scien.cx/2025/01/13/scan-your-linux-disk-and-visualize-it-on-mac-with-grandperspective/
IEEE
" » Scan Your Linux Disk and Visualize It on Mac with GrandPerspective." kojix2 | Sciencx [Online]. Available: https://www.scien.cx/2025/01/13/scan-your-linux-disk-and-visualize-it-on-mac-with-grandperspective/. [Accessed: ]
rf:citation
» Scan Your Linux Disk and Visualize It on Mac with GrandPerspective | kojix2 | Sciencx | https://www.scien.cx/2025/01/13/scan-your-linux-disk-and-visualize-it-on-mac-with-grandperspective/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.