5 unstable releases

0.3.2 Sep 22, 2022
0.3.1 Sep 21, 2022
0.3.0 Sep 15, 2022
0.2.0 Sep 15, 2022
0.1.0 Aug 24, 2022

#2061 in Command line utilities

31 downloads per month


198 lines


head and tail simultaneously!


Not finding an existing utility to head and tail the output, nor a good way to combine existing utilities even with the help of a couple friends of mine, we decided to make one. We ended up doing a "day of learning" session with about 50 other engineers from GitHub and collaboritively came up with a minimum viable solution that worked well!

Now it's a real utility that we keep improving. Go try it out!


Contributions are welcome! Here are some good first issues you could look into.

Quick Start

You need to have Rust installed.

# Install latest *release* version of headtail
$ cargo install headtail
# Use it on a file - prints the first 10 and last 10 lines
$ headtail somebigfile.txt

# Pipe stdout to it - prints the first 10 and last 10 lines
$ somecommand | headtail

# Print the first 25 and last 5 lines of a file
$ headtail somebigfile.txt -H 25 -T 5

# Print the default amount of first lines, but only 3 last lines
$ headtail somebigfile.txt -T 3

# Do the default thing...but then keep tailing the file and print
# out anything new that is appended to it.
$ headtail somebigfile.txt -f

See headtail -h for a full list of command-line options.


# Run locally with arguments
$ cargo run -- YOUR_ARGS_GO_HERE

# Enable debug logging
$ RUST_LOG=trace cargo run -- YOUR_ARGS_GO_HERE

# Install local development version of headtail into your ~/.cargo/bin
$ cargo install --path .

Software License

Distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See license/APACHE and license/MIT.


~168K SLoC