Home

Awesome

The Tin Summer

Windows build status Build Status

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

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.

Installation

Script

Enter the following in a command prompt:

curl -LSfs https://japaric.github.io/trust/install.sh | sh -s -- --git vmchale/tin-summer

Binary install

If the script doesn't work for you, you can download a binary from the releases page.

Cargo

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

Use

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 $DIR:

 $ 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

Accessibility

To turn off colorized output:

export CLICOLOR=0

Comparison (or, 10 Things I Hate About du)

Reasons to use du

Reasons to use sn

Benchmark results

Directory SizeToolCommandTime
600MBsnsn p60.74 ms
600MBsnsn d99.92 ms
600MBdudu -hacd288.28 ms
4GBsnsn p185.2 ms
4GBsnsn d271.9 ms
4GBdudu -hacd2195.5 ms
700MBsnsn p91.05 ms
700MBsnsn d176.3 ms
700MBdudu -hacd2153.8 ms
7MBsnsn p19.48 ms
7MBsnsn d12.72 ms
7MBdudu -hacd210.13 ms

These commands are all essentially equivalent in function, except that sn p may use more threads than sn a or du. Results were obtained using Gabriel Gonzalez's bench tool. You can see pretty criterion graphs here or here.

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

Displaying a user's timeline in a terminal.

du

Displaying a user's timeline in a terminal.

Heuristic for build artifacts

Currently, 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 directories", like .stack-work, elm-stuff, etc. and if it finds a configuration file like tweet-hs.cabal, it considers all their contents to be build artifacts.

Languages Supported

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.

Autoclean

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