Three small GNU Coreutils commands can make everyday terminal work easier: shuf randomizes lines or picks a sample, timeout limits how long a command runs, and tee saves output while passing it along. Their names and basic forms are easy to remember; just keep in mind that availability and details can vary with your Linux distribution and installed Coreutils version.
Use shuf to randomize lines or pick a sample
shuf outputs a random permutation of input lines. Add -n to limit how many lines it prints:
As an Amazon Associate I earn from qualifying purchases.
shuf -n 3 names.txt
This prints three randomly selected lines from names.txt. It is handy for a quick sample or casual randomized choice—not for a security decision or a high-stakes lottery.
You can also provide values directly with -e, or ask for a range of numbers with -i:
#1 Best Overall
shuf -i 1-10
shuf -e red blue green
By default, each supplied value appears at most once in the shuffled output. Add -r to sample with replacement, which means values can repeat:
shuf -r -n 5 -e red blue green
These examples follow the GNU Coreutils 9.11 shuf documentation.
Use timeout to put a limit on a command
When a command might take too long, prefix it with timeout and a duration:
Crashes, 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 minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11timeout 10s some-command
GNU Coreutils sends the command a TERM signal when the specified interval expires. A timeout normally returns exit status 124. The actual timing and cleanup depend on system conditions and on what the command starts; this is not a guarantee that every child process will be stopped immediately. GNU documents special behavior in foreground mode: it does not time out children of the managed process.
GNU Coreutils also supports alternate signals, a kill-after interval, and --preserve-status for cases where you need different signal or exit-status behavior. Check the GNU Coreutils 9.10 timeout documentation for the exact options and their effects.
Use tee to watch and save output
tee copies standard input both to standard output and to one or more files. That lets output remain visible in the terminal while a file captures it:
Rank #4
make 2>&1 | tee build.log
Here, 2>&1 sends standard error to standard output before the pipe, so both streams are sent through tee. By default, tee overwrites an existing output file. Use -a when you intend to append instead:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →make 2>&1 | tee -a build.log
In some shells, the pipeline’s exit status may reflect only its last command, masking a failure from the command before tee. For example, Bash supports set -o pipefail to make a pipeline return a failure status if a command in it fails. That behavior belongs to the shell, not to tee. See the GNU Coreutils 9.11 tee documentation.
Best Value
Where to check availability and syntax
These documented behaviors are for GNU Coreutils; an individual system may have a different implementation, version, or package installed. If a command is missing or an option behaves differently, consult your system’s manual page or installed package documentation rather than assuming every Linux distribution is identical.
For a quick refresher on common command syntax, the community-maintained tldr-pages website offers concise examples alongside fuller 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.
Recommended Free Tools




