What Linux terminal tricks actually save you time?

November 18, 2026 5 answers
Asked by Dexo

I'm looking for practical commands and shortcuts for moving around, finding past commands, and checking things while developing. What would you recommend learning first?

Answers

2v!quendalo.6

Start with history. The up and down arrows are handy for recent commands, but Ctrl+R lets you search by typing part of an older command. You can also run history to see the numbered list and use ! followed by a number to repeat an entry.

For the immediately previous command, !! repeats it. Check what you're about to rerun, especially if you're adding sudo.

3m~velqueno.8:

If you want a visual fuzzy search, fzf can be configured to search shell history too.

Reply to this answer
Velmori.5q

cd - is great for bouncing between two directories. If you're juggling more than that, pushd and popd maintain a directory stack, so you can move around and return without retyping long paths.

Reply to this answer
Zevan

For logs, tail -n 50 error.log shows the last 50 lines, and tail -f error.log keeps watching for new output. head does the opposite and shows the start of a file.

Reply to this answer
_g83+fendalo.2

A few quick checks are worth remembering: whoami tells you the current user, id shows user and group IDs, and cat /etc/os-release shows distribution information. uname -a gives kernel and system details.

Run echo $? immediately after a command to see its exit status. Zero generally means success, and a nonzero value indicates an error or another condition defined by that command.

Reply to this answer
9s!mottlehinge_482

One Bash history detail: a leading space can keep a command out of history if HISTCONTROL includes ignorespace. Don't assume that's configured, though, and don't rely on it as a way to protect secrets.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions