Free tools Windows power users keep installed
One-click scans. No signup required.
iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Three small Linux commands can solve everyday terminal problems without a script: shuf randomizes lines or picks a sample, timeout puts a time limit on a command, and tee saves output while letting it continue through a pipeline. These examples describe GNU Coreutils behavior; availability and details can vary with your distribution, installed package, and version.
1. Use shuf to mix lines or pick a sample
shuf outputs a random permutation of input lines. Add -n to limit how many lines it prints:
shuf -n 3 names.txt
This prints three randomly selected lines from names.txt. It is handy for a casual choice or a quick sample from a list. GNU Coreutils 9.11 also accepts explicit values with -e and can generate a range with -i:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
shuf -i 1-10
To choose five values from a short list while allowing repeats, use replacement mode, -r:
#1 Best Overall
shuf -r -n 5 -e red blue green
Without -r, the output is a permutation of the supplied values, so a value will not appear more times than it appears in the input. These are ordinary randomization conveniences, not a basis for security decisions or a cryptographic lottery. See the GNU Coreutils 9.11 shuf documentation.
2. Use timeout to bound a command’s run time
Put a duration before a command to have GNU timeout signal it when that interval expires:
timeout 10s some-command
GNU Coreutils 9.10 uses TERM by default. A timeout normally returns status 124; scripts can use that status to distinguish a timeout from many other outcomes. The command’s actual stopping time can depend on system conditions and how it responds to the signal, so this is not a guarantee of instantaneous cleanup.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteGNU timeout also supports alternate signals, a kill-after interval, and --preserve-status. In foreground mode it does not time out children of the managed process. Consider the process tree and signal-handling behavior when using it to contain work that may launch other processes. See the GNU Coreutils 9.10 timeout documentation.
3. Use tee to save output as it flows
tee copies standard input both to standard output and to one or more files. This lets you watch a command’s output while saving it:
make 2>&1 | tee build.log
Here, 2>&1 sends standard error to the same place as standard output before the pipe, so both streams reach tee. The output remains visible in the terminal and is written to build.log. By default, an existing file with that name is overwritten. Add -a to append instead:
Rank #4
make 2>&1 | tee -a build.log
One scripting detail: in some shells, a pipeline’s reported status reflects only its last command, which can hide a failure from the command before tee. In Bash, enable pipefail when you want the pipeline to report an earlier failure:
set -o pipefail
make 2>&1 | tee build.log
That behavior belongs to the shell’s pipeline status rules, not to tee. See the GNU Coreutils 9.11 tee documentation.
Best Value
Remember the job, not just the spelling
shuf: shuffle input lines or take a limited random sample.timeout: give a command a time limit and signal it when the limit expires.tee: save a stream to a file while forwarding it onward or to the terminal.
For short command examples to keep nearby, tldr-pages offers community-maintained practical summaries alongside fuller references such as manual pages.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

