The Tin Summer
If you do a significant amount of programming, you'll probably end up with
build artifacts scattered about.
sn is a tool to help you find those
sn is also a replacement for
du. It has nicer
output, saner commands and defaults, and it even runs faster on big directories
thanks to multithreading.
Enter the following in a command prompt:
curl -LSfs https://japaric.github.io/trust/install.sh | sh -s -- --git vmchale/tin-summer
If the script doesn't work for you, you can download a binary from the releases page.
If your platform doesn't have binaries, or you just want to build from source, get cargo. Then:
$ cargo install tin-summer
Make sure you are on nightly; otherwise
$ rustup run nightly cargo install tin-summer
To list directory and file sizes for the current directory:
$ sn f
To get a list of directory sizes concurrently, excluding version control:
$ sn p --exclude '\.git|\.pijul|_darcs|\.hg'
To get a sorted list of the 12 biggest directories in
$ sn sort $DIR -n12
To search current directory for directories with build artifacts:
$ sn ar
To look for artifacts or directories containing artifacts that occupy more than 200MB of disk space:
$ sn ar -t200M
To turn off colorized output:
Comparison (or, 10 Things I Hate About du)
Reasons to use
- Reads disk usage, not just file sizes
- Optionally dereferences symlinks
- Slightly faster on small directories
- Stable and well-supported
Reasons to use
- Faster on large directories
- Uses regex for exclusions, making it
dramatically faster than
duwhen used with the
- Defaults to human-readable output
- Colorized output
- Nicer help via clap
- Provides sorted output
- Finds build artifacts
- Reads file sizes, not disk usage
- Extensible in Rust
These commands are all essentially equivalent in function, except that
may use more threads than
sn a or
du. Results were obtained using Gabriel Gonzalez's bench
tool. You can see pretty criterion graphs
In summary: yes,
sn actually is faster on larger directories, but it is also
slower on small ones. I'm hoping to make it faster in the future; the current
naïve concurrency model has obvious directions for improvement.
Screenshots (alacritty + solarized dark)
The Tin Summer
Heuristic for build artifacts
sn looks for files that either have an extension associated with
build artifacts, or executable files that are ignored by version control. It also looks for "build
elm-stuff, etc. and if it finds a
configuration file like
tweet-hs.cabal, it considers all their
contents to be build artifacts.
The following is a list of languages
sn artifacts has been tested with.
The intent is to support basically anything, so feel free to open a PR or start an issue.
- Haskell (incl. GHCJS)
sn can clean up your artifacts for you, but only for the above-indicated
languages. It is still experimental, but it has been tested and should not
delete unwanted files (though it may not clean everything it should).