A tiny trick I almost forgot about

When testing out things on the terminal, often times we get a lot of output back, especially if there is some kind of error. If we do this repeatedly, it’s easy to lose track of where an older run finished and where the new run started, which requires additional brain cycles to just find the starting point for the latest run.

I’m sure there are a gazillion smarter solutions to this, but here’s mine in full copy-and-paste splendor:

cat > ~/bin/newlines <<'END'
printf '\n\n\n\n\n\n\n'
exec "$@"
chmod +x ~/bin/newlines

It’s just a wrapper that prints some newlines and then executes the original command (to avoid putting additional processes in the middle, should this matter for you).

At this point, just invoke your command pre-pending newlines:

$ date
Sat Apr 25 13:09:33 CEST 2020
$ date
Sat Apr 25 13:09:34 CEST 2020
$ date
Sat Apr 25 13:09:35 CEST 2020
$ newlines date

Sat Apr 25 13:09:36 CEST 2020

Isn’t this cute?

Comments? Octodon, , GitHub, Reddit, or drop me a line!