Terminal disk space navigator 🔭

Last update: May 24, 2022

diskonaut

demo

How does it work?

Given a path on your hard-drive (which could also be the root path, eg. /). diskonaut scans it and indexes its metadata to memory so that you could explore its contents (even while still scanning!).

Once completed, you can navigate through subfolders, getting a visual treemap representation of what's taking up your disk space. You can even delete files or folders and diskonaut will track how much space you've freed up in this session.

Installation

Download a prebuilt binary

If you're using linux, you can check out the "releases" of this repository to download the latest prebuilt binary.

With cargo (linux / macOS / windows)

cargo install diskonaut

Fedora/CentOS

sudo dnf install diskonaut

For older Fedora releases and CentOS available in COPR:

sudo dnf copr enable atim/diskonaut -y
sudo dnf install diskonaut

Arch Linux

Available in the AUR:

yay diskonaut

Gentoo

Available through the following overlay as sys-fs/diskonaut:

https://github.com/telans/EBUILDS

Nix / NixOS

Available in nixpkgs:

$ nix-env --install diskonaut
$ # (Or using the attribute name, which is also diskonaut.)

FreeBSD

Available in freshports:

pkg install diskonaut

macOS

Available in Homebrew

brew install diskonaut

Also available in nixpkgs: see Nix section for more details.

Supported platforms

Right now diskonaut supports linux, macos and windows.

Usage

Either start diskonaut in the folder you want to scan, or provide it with the folder you'd like to scan as an argument:

$ diskonaut /home/aram

Contributing

Contributions of any kind are very much welcome. If you think diskonaut is cool and you'd like to hack at it, feel free to look through the issues. Take a look especially at ones marked "help wanted" or "good first issue". Also, if you found a bug or have an idea for a new feature, please feel free to open an issue to discuss it.

For more detailed information, please see the CONTRIBUTING.md file at the root of this repository.

If at any point you feel stuck, are unsure how to begin or what to work on, please do not hesitate to reach out to me personally: [email protected]

License

MIT

GitHub

https://github.com/imsnif/diskonaut
Comments
  • 1. windows version

    100% conversion to crossterm (no dual mode)

    seems to work fine, test on windows 10 using new windows terminal and powershell works on my rasp pi system too

    tests all compile but dont run

    Reviewed by pm100 at 2020-09-15 19:00
  • 2. Tests fail because diskonaut reports incorrect file sizes on filesystems with compression

    On my machine and several CI builders, diskonaut tests fail. The problem is that the rust-filesize uses MetadataExt::blocks to get the number of file blocks:

    https://github.com/Freaky/rust-filesize/blob/e8042c00cebd215ac9f106e8b5a20b0c072fd77d/src/lib.rs#L72

    However, this method is not reliable. For example:

    $ cat blksize.rs 
    use std::fs;
    use std::os::unix::fs::MetadataExt;
    use std::io;
    
    fn main() -> io::Result<()> {
        let meta = fs::metadata("2pow20bytes")?;
        let blocks = meta.blocks();
        let block_size = meta.blksize();
        eprintln!("blocks: {}, block size: {}", blocks, block_size);
        Ok(())
    }
    $ rustc blksize.rs
    $ dd if=/dev/zero of=2pow20bytes bs=1024 count=1024
    $ ls -l 2pow20bytes 
    -rw-r--r-- 1 daniel users 1048576 Jun 25 19:48 2pow20bytes
    $ ./blksize 
    blocks: 1, block size: 131072
    

    So, this will be reported as a 512 byte file(!), even though it is 1MiB. The wonders of (ZFS) filesystem compression.

    $ dd if=/dev/urandom of=2pow20bytes bs=1024 count=1024
    $ ./blksize 
    blocks: 2065, block size: 131072
    
    Reviewed by danieldk at 2020-06-25 17:50
  • 3. thread 'main' panicked at 'index out of bounds: the len is 3600 but the index is 3600

    /mnt/n/AppData/Local/Bisq/runtime/include/win32/bridge                                      thread 'main' panicked at 'index out of bounds: the len is 3600 but the index is 3600', /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libcore/slice/mod.rs:2842:10
    

    asciicast

    Running in WSL 2 with rustc 1.43.0 (4fb7144ed 2020-04-20).

    Reviewed by jonahsnider at 2020-06-25 22:27
  • 4. Emacs keybindings

    Fixes #36 ... again I've added a key! macro to make it easier to define patterns like Event::Key(Key::Char(..))

    In my first PR I think I replaced one of the other keybindings with \n when it was supposed to be n, so this should fix that, since the tests are working locally. Although for some reason if I run the same tests multiple times without changing the code I get different results.

    Reviewed by redzic at 2020-06-22 01:58
  • 5. Resolving #16 - Feature: add an "Are you sure you want to quit?" modal

    this commit will add an ability to the app which asks user for confirmation just before exit, both in normal and loading mode. please feel free to comment or ask for any changes.

    squashed commits:

    • add keyEvent handler function for exiting mode
    • add Exiting variant to UiMode enum | add prompt_exit method
    • implement ExitingMode widget render functionality
    • fix mixed UiState issue
    Reviewed by mhdmhsni at 2020-06-22 20:50
  • 6. Platform: windows port

    There are two main things I know of that we need to do to port diskonaut to work on windows:

    1. Currently we rely on hard disk blocks to scan the hard-drive. As far as I know, this does not work on windows, and so we need to find another solution.
    2. Termion doesn't(?) work on windows, so we would need to use another backend for TUI.

    I am VERY interested in a solution for this. If you want to work on this and are unsure how to begin, or the points above are not clear, I would be very happy to discuss this with you further and clarify anything. Please do not hesitate. :)

    Reviewed by imsnif at 2020-06-17 14:53
  • 7. Performance

    Scanning large volumes with diskonaut takes some time. Not terrible (likely less than 10 minutes for really populated volumes) but this is still not the best experience.

    It could be nice to experiment with scanning parallelization, as long as it does not impact performance. I feel a slow scan is better than a fast scan that makes your computer stuck and unable to do anything else.

    Reviewed by imsnif at 2020-06-17 15:23
  • 8. Make enter select largest folder if nothing is selected

    Fixes #37 Although, the way it is now, it will only select (but not cd into) the largest folder if nothing is selected. From the wording "... the app goes into the largest folder" in the comment of #37 I wasn't really sure if it should cd into the largest folder or just select it. However, if should also cd into it, it should be a very trivial change in the handle_enter function.

    Reviewed by redzic at 2020-06-23 17:31
  • 9. Feature: add an "Are you sure you want to quit?" modal

    Right now, when we press "Ctrl-C" or "q" to exit, the app exits immediately. It would be nice if we could add a modal that prompts the user in case they pressed this by mistake.

    Reviewed by imsnif at 2020-06-17 14:57
  • 10. Feature: Support for Filesystem Compression (e.g. NTFS, BTRFS, ...)

    When running diskonaut on a BTRFS filesystem with compression enabled, it shows the uncompressed space used by folders and files, not the actual disk-space used.

    One folder of mine using 69.5G of storage, but if I delete this folder I would not regain 69.5G worth of disk space because that folder is being compressed instead I would only regain 50G of space which represents the actual space used on the disk.

    The command [sudo compsize /path/to/folder] was able to identify the post-compression space used.

    Rationale for feature:

    If I am using this tool, I am likely trying to free space so that I may allocate a new file.

    Suppose I want to download a 4GiB iso image. If I have a 4.5GiB zip archive and a 5GiB text-file, diskonaut would make it appear that deleting the text-file would let me download the iso with a GiB to spare. Unfortunately, with compression enabled, the compressible zip archive would still free up 4.5GiB while the highly compressible text-file may only free a 900MiB. At that point I would download the iso, run out of space and then have to reopen diskonaut to free ? more GiB (and hope that compression doesn't cause more trouble).

    Design Questions

    • How should the compressed vs uncompressed space be represented in the UI?

      The uncompressed usage may still be useful if I plan on copying my files to a location without compression.

    • On filesystems where it is relatively slow to compute the compressed disk usage, should there be a fast estimation run where placeholders (e.g. 69.5G??? would be displayed above) until the slower more accurate run occurs.

      • How should the estimation be displayed? I chose 69.5G??? earlier but maybe <69.5G> or some other formatting makes more sense.
    • What configuration flags should be added?

      • Formatting
      • Enabling/Disabling feature
      • Enabling/Disabling faster estimation process.

    Relevant Filesystems

    This Wikipedia table of filesystem capabilities shows that the following support compression.

    • BeeGFS
    • APFS
    • NTFS
    • F2FS
    • Reiser4
    • NSS
    • NWFS
    • Fossil
    • ZFS
    • BTRFS
    • SquashFS
    Reviewed by dbramucci at 2020-06-18 01:35
  • 11. Resolving #32: implement a warning modal on deleting a file/folder while s…

    Hi @imsnif, this commit resolves https://github.com/imsnif/diskonaut/issues/32.

    • added WarningBox to modals module.
    • rendering logic is similar to other modals. nothing specific to mention.
    • about the auto close functionality i added a WarningTimeout variant to your Event enum. this event waits for 5 seconds then resets the ui state using Instruction::ResetUiMode.

    please let me know if anything needs to change.

    Reviewed by mhdmhsni at 2020-07-02 10:55
  • 12. The folder takes up too much space (7091231513.3G)

    The folder takes up too much space (7091231513.3G) in fact, the folder takes up 659 KB OS: Ubuntu 20.04.4 LTS on Windows 10 x86_64 Shell: bash 5.0.17 зображення зображення

    Reviewed by David-Valters at 2022-04-02 10:21
  • 13. aarch64 and armhf doest pass tests ?

    Hey there,

    I'm packaging diskonaut for Alpine Linux but it seems tests fails for those two architectures.

    https://gitlab.alpinelinux.org/StacyHarper/aports/-/pipelines/114814

    Is it known ?

    edit: and it seems that armv7 can also fail o_O https://gitlab.alpinelinux.org/StacyHarper/aports/-/pipelines/114819

    Reviewed by stacyharper at 2022-03-15 15:46
  • 14. offer prebuild deb files in a ppa

    It would be useful to have prebuild deb packages in a ppa at https://launchpad.net . So people can install it with getting updates and without having to compile it themself.

    Reviewed by freddii at 2021-01-09 14:53
Checks if there are enough space in a specified path.

@planetarium/check-free-space This package uses native OS APIs to get free size available on specified path. It is powered by fs2 under the hood. APIs

Mar 22, 2022
Terminal bandwidth utilization tool
Terminal bandwidth utilization tool

bandwhich This is a CLI utility for displaying current network utilization by process, connection and remote IP/hostname How does it work? bandwhich s

May 25, 2022
Blazing 💥 fast terminal-ui for git written in rust 🦀
Blazing 💥 fast terminal-ui for git written in rust 🦀

Blazing fast terminal client for git written in Rust Features Fast and intuitive keyboard only control Context based help (no need to memorize tons of

May 28, 2022
Terminal disk space navigator 🔭
Terminal disk space navigator 🔭

Given a path on your hard-drive (which could also be the root path, eg. /). diskonaut scans it and indexes its metadata to memory so that you could explore its contents (even while still scanning!).

May 23, 2022
dua (-> Disk Usage Analyzer) is a tool to conveniently learn about the usage of disk space of a given directory

dua (-> Disk Usage Analyzer) is a tool to conveniently learn about the usage of disk space of a given directory. It's parallel by default and will max

May 20, 2022
Save disk space by cleaning non-essential files from software projects.
Save disk space by cleaning non-essential files from software projects.

Kondo ?? Cleans unneeded directories and files from your system. It will identify the disk space savings you would get from deleting temporary/unneces

May 26, 2022
osu-link is a program which links osu!stable beatmaps to osu!lazer's new store format, saving you disk space.

osu-link is a program which links osu!stable beatmaps to osu!lazer's new store format, saving you disk space.

Nov 8, 2021
CoreOS Disk Image Rehydrator

In CoreOS we ship a lot of disk images, one for each platform. These are almost entirely the same thing, mostly just with an ignition.platform.id stamp in each disk image, wrapped in a hypervisor/platform specific container.

Jan 19, 2022
Zenith - sort of like top or htop but with zoom-able charts, CPU, GPU, network, and disk usage
Zenith - sort of like top or htop but with zoom-able charts, CPU, GPU, network, and disk usage

Zenith - sort of like top or htop but with zoom-able charts, CPU, GPU, network, and disk usage

May 22, 2022
disk backed wal queue

Repository Template  Queue like disk backed WAL Pronouced Quál - from the german wordrd for agony - because it is. Operations The basic concept is si

Mar 12, 2022
A tool to subscribe to Twitch channels and store them efficiently on disk

twitch-messages A tool to subscribe to Twitch channels and store them efficiently on disk Build the Tools You can start by building the binaries that

Oct 31, 2021
Count zeroes on a disk or a file

Count zeroes on a disk or a file

Dec 12, 2021
"putzen" is German and means cleaning. It helps keeping your disk clean of build and dependency artifacts safely.

Putzen "putzen" is German and means cleaning. It helps keeping your disk clean of build and dependency artifacts safely. About In short, putzen solves

Jan 31, 2022
A library for loading and executing PE (Portable Executable) from memory without ever touching the disk

memexec A library for loading and executing PE (Portable Executable) from memory without ever touching the disk This is my own version for specific pr

May 3, 2022
A tiling window manager for Windows 10 based on binary space partitioning
A tiling window manager for Windows 10 based on binary space partitioning

yatta BSP Tiling Window Manager for Windows 10 Getting Started This project is still heavily under development and there are no prebuilt binaries avai

Apr 17, 2022
Fast Hilbert space-filling curve transformation using a LUT
Fast Hilbert space-filling curve transformation using a LUT

Fast Hilbert Fast Hilbert 2D curve computation using an efficient Lookup Table (LUT). Convert from discrete 2D space to 1D hilbert space and reverse V

May 2, 2022
A space-themed shoot 'em up game.

Zenith A space-themed shoot 'em up game made with Bevy. Building from source After you clone this repository, ensure you have Rust installed. Dependin

May 9, 2022
CLI search and replace | Space Age seD
CLI search and replace | Space Age seD

SAD! Space Age seD What does it do? Basically sad is a Batch File Edit tool. It will show you a really nice diff of proposed changes before you commit

May 19, 2022
EXPERIMENTAL: Bitcoin Core Prometheus exporter based on User-Space, Statically Defined Tracing and eBPF.

bitcoind-observer An experimental Prometheus metric exporter for Bitcoin Core based on Userspace, Statically Defined Tracing and eBPF. This demo is ba

Feb 17, 2022
A quick and dirty Space Invaders type game in Bevy, with attached tutorial.

This article is in-development and will be released in full form soon. It'll appear on Medium (my publisher likes that), with this as a the accompanyi

Feb 5, 2022