Stop losing your place when scripts dump massive amounts of text

Shell Scripting / Bash Tricks

Stop losing your place when scripts dump massive amounts of text

🧩 The Challenge

Dealing with a script that spits out thousands of lines of output makes my head spin when I’m trying to track down a single error. Scrolling through a terminal buffer is a nightmare when you’re looking for that one needle in a giant haystack.

💡 The Fix

Use a simple function to pipe your output into a pager that automatically handles long lines and lets you search through the mess without losing your spot. It’s way better than just redirecting to a file and grepping over and over.

function viewout() { "$@" | less -RFX; }
viewout ./your-long-running-script.sh

⚙️ Why It Works

Setting the -R flag allows the pager to keep color formatting, while -F and -X tell it to exit immediately if the content fits on one screen and keep the output visible after it exits so you don’t lose your place.

🚀 Pro-Tip: Alias this to something like ‘v’ and you’ll save yourself an eternity of scrolling.

Linux Tips & Tricks | © ngelinux.com | 7/25/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted