Terminal disk space navigator 🔭

Overview

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

Comments
  • windows version

    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

    opened by pm100 22
  • Tests fail because diskonaut reports incorrect file sizes on filesystems with compression

    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
    
    bug 
    opened by danieldk 13
  • thread 'main' panicked at 'index out of bounds: the len is 3600 but the index is 3600

    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).

    bug discussion 
    opened by jonahsnider 12
  • Emacs keybindings

    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.

    opened by redzic 12
  • Resolving #16 - Feature: add an

    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
    opened by mhdmhsni 11
  • Platform: windows port

    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. :)

    help wanted 
    opened by imsnif 10
  • Performance

    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.

    opened by imsnif 9
  • Make enter select largest folder if nothing is selected

    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.

    opened by redzic 8
  • Feature: add an

    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.

    good first issue 
    opened by imsnif 8
  • Feature: Support for Filesystem Compression (e.g. NTFS, BTRFS, ...)

    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
    bug discussion 
    opened by dbramucci 7
  • Resolving #32: implement a warning modal on deleting a file/folder while s…

    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.

    opened by mhdmhsni 6
  • aarch64 and armhf doest pass tests ?

    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

    opened by stacyharper 0
  • offer prebuild deb files in a ppa

    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.

    opened by freddii 0
  • Added production-ready Dockerfile

    Added production-ready Dockerfile

    Hey, We added production-ready Dockerfile to ur project. U can add CI/CD to that to automate pushing to Docker Hub. If u want to test how it works u have to build image.

    docker build . -t diskonaut
    

    After that u can use it as normally installed app.

    docker run -t -v absolute_path:container_path diskonaut container_path
    

    Co-Authored-By: kaurelia [email protected]

    opened by KrzysztofZawisla 0
Releases(0.11.0)
Owner
Aram Drevekenin
Aram Drevekenin
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

Benjamin Vaisvil 1.6k Dec 3, 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

FssAy 5 Aug 27, 2022
garbage-collecting on-disk object store, supporting higher level KV stores and databases.

marble Garbage-collecting disk-based object-store. See examples/kv.rs for a minimal key-value store built on top of this. Supports 4 methods: read: de

Komora 160 Nov 25, 2022
Executables on Disk? Bleh 🤮

Executables on Disk? Preposterous! Saving executables to disk is like telling EDRs that "Hey! Take a look at this thing I just fetched from the Intern

whokilleddb 82 Dec 1, 2022
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

i love my dog 966 Nov 26, 2022
Santa Claus has to optimize the space for everyone present on the sled.

How to generate all sets of P packages into N bags Santa Claus has to optimize the space for everyone present on the sled Description Santa Claus got

João Nuno Carvalho 2 Apr 26, 2022
:large_orange_diamond: Build beautiful terminal tables with automatic content wrapping

Comfy-table Comfy-table tries to provide utility for building beautiful tables, while being easy to use. Features: Dynamic arrangement of content to a

Arne Beer 499 Nov 24, 2022
🛎 60+ Elegant terminal spinners for Rust

Spinners - ?? 60+ Elegant terminal spinners for Rust ❤️ Shameless plug Charts, simple as a URL. No more server-side rendering pain, 1 url = 1 chart Lo

Francois-Guillaume Ribreau 425 Nov 27, 2022
Low-level Rust library for implementing terminal command line interface, like in embedded systems.

Terminal CLI Need to build an interactive command prompt, with commands, properties and with full autocomplete? This is for you. Example, output only

HashMismatch 47 Nov 25, 2022
Rust library for ANSI terminal colours and styles (bold, underline)

rust-ansi-term This is a library for controlling colours and formatting, such as red bold text or blue underlined text, on ANSI terminals. View the Ru

Benjamin Sago 403 Dec 3, 2022
Cross-platform Rust library for coloring and formatting terminal output

Coloring terminal output Documentation term-painter is a cross-platform (i.e. also non-ANSI terminals) Rust library for coloring and formatting termin

Lukas Kalbertodt 75 Jul 28, 2022
create and test the style and formatting of text in your terminal applications

description: create and test the style and formatting of text in your terminal applications docs: https://docs.rs/termstyle termstyle is a library tha

Rett Berg 18 Jul 3, 2021
A dead simple ANSI terminal color painting library for Rust.

yansi A dead simple ANSI terminal color painting library for Rust. use yansi::Paint; print!("{} light, {} light!", Paint::green("Green"), Paint::red(

Sergio Benitez 168 Nov 20, 2022
(Rust) Coloring terminal so simple you already know how to do it !

Colored Coloring terminal so simple, you already know how to do it! "this is blue".blue(); "this is red".red(); "this is red on blue".red(

Thomas Wickham 1.2k Nov 29, 2022
Cross platform terminal library rust

Cross-platform Terminal Manipulation Library Crossterm is a pure-rust, terminal manipulation library that makes it possible to write cross-platform te

crossterm-rs 2k Dec 1, 2022
Build terminal user interfaces and dashboards using Rust

tui-rs tui-rs is a Rust library to build rich terminal user interfaces and dashboards. It is heavily inspired by the Javascript library blessed-contri

Florian Dehau 9.1k Dec 4, 2022
Currency exchange rates in your terminal

Usage example Rates is a scriptable CLI tool that brings currency exchange rates right into your terminal and supports 30+ fiat and 10K+ crypto currencies.

Lunush 89 Nov 9, 2022
My terminal emulator

Miro A GPU-accelerated terminal emulator written in Rust. miro -t pika miro -t kirby miro -t mario miro -t sonic Building from source

Ossama Hjaji 282 Nov 22, 2022
Alacritty - A fast, cross-platform, OpenGL terminal emulator

Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows.

Alacritty 43.3k Nov 30, 2022