Using Linux Commands Every Day? Explore Advanced Features to Simplify Your Routine

If you spend a lot of time in a Linux terminal, you probably already know the commands you use dozens of times a day: cdlsgrepfindssh, and systemctl.

But some of the most useful shell features are easy to overlook.

A command gets stuck longer than expected. You run df -h again just to check whether a disk is filling up. You disconnect from SSH and realize a long-running job is still attached to your terminal. Or you type out the same long command for the third time because you forgot a small option.

These aren’t major problems, but they add up.

Over time, a handful of lesser-known Linux commands and shell shortcuts can make everyday terminal work much easier. Here are 10 that are worth adding to your toolbox.

1. timeout — Stop Commands That Take Too Long

Some commands are fine when they finish quickly. Others can sit there indefinitely when a network connection fails or a process gets stuck.

That’s where timeout comes in.

It lets you put a time limit on a command. If the command doesn’t finish within that period, timeout sends it a signal.

# Stop ping after 5 seconds
timeout 5s ping example.com

You can also specify which signal should be sent:

# Send SIGKILL if the command is still running after 10 seconds
timeout -s KILL 10s ./run-flaky-job.sh

This is particularly useful in scripts, automation, and CI/CD jobs where you don’t want one stuck process to block everything that follows.

See also: Mastering the Linux Command Line — Your Complete Free Training Guide

For example, a network check that normally takes a second or two probably shouldn’t be allowed to hang for several minutes. For the full syntax and more examples, see A Complete Guide to the timeout Command in Linux.

2. Tab Completion Isn’t Just for Filenames

Most Linux users know that pressing Tab can complete a filename or directory.

But with bash-completion installed, it can do considerably more.

On Debian or Ubuntu:

sudo apt install bash-completion

On RHEL or Fedora:

sudo dnf install bash-completion

Depending on the command, completion can help with subcommands, options, Git branches, systemd units, and more.

For example:

git checkout fe<Tab>

can complete a Git branch.

Likewise:

systemctl restart nginx.<Tab>

can help you discover matching systemd units — handy if you’re still getting comfortable with how to use the systemctl command in Linux.

Once you get used to it, pressing Tab before typing something manually becomes second nature.

3. watch — Keep an Eye on Changing Output

Sometimes you don’t need a monitoring system. You just need to run the same command every few seconds and see what’s changing.

That’s exactly what watch is good at.

watch -d df -h

The command above runs df -h repeatedly and highlights differences between updates — useful when you’re tracking down disk usage and disk utilization issues.

You can control the interval with -n:

watch -n 1 -d kubectl get pods

This refreshes the Kubernetes pod list every second.

It’s handy when you’re waiting for something to happen:

  • a disk usage value to change
  • a Kubernetes pod to become Running
  • a deployment to finish
  • a process count to change
  • a service status to update

Instead of repeatedly pressing the up arrow and Enter, let watch do it for you.

4. xargs — Turn Command Output Into Arguments

xargs becomes useful whenever one command produces a list of things that another command needs to process.

A common example is combining find and xargs.

But there’s an important detail: filenames can contain spaces and other special characters.

This can cause problems:

find . -type f -name "*.tmp" | xargs rm

A filename such as:

old backup.tmp

may be interpreted as two separate arguments.

A safer approach is to use null characters:

find . -type f -name "*.tmp" -print0 | xargs -0 rm -v

Here, find -print0 separates filenames with a null character, while xargs -0 expects the same delimiter. For more patterns like this, see advanced find, exec, and xargs examples.

This is a small difference, but it matters when you’re writing commands that operate on many files.

And whenever you’re deleting files, it’s worth checking what the command will match before adding rm — our guide on how to delete files in Linux covers safer ways to do this.

5. Brace Expansion — Create Multiple Things With One Command

Bash can generate multiple strings from a single expression using brace expansion.

For example:

mkdir -p project/{src,tests,docs,config}

creates:

project/src
project/tests
project/docs
project/config

You can also use it to generate numbered filenames:

touch file_{01..05}.txt

which creates:

file_01.txt
file_02.txt
file_03.txt
file_04.txt
file_05.txt

There’s another handy trick for making a quick backup:

cp nginx.conf{,.bak}

Bash expands that into:

cp nginx.conf nginx.conf.bak

Once you recognize brace expansion, you’ll start seeing quite a few situations where a small expression can replace a short shell loop.

6. !! — Run the Previous Command Again

Here’s a familiar situation.

You run:

apt update

and get a permission error because the command requires root privileges.

Instead of typing the whole command again, you can use:

sudo !!

!! refers to the previous command, so Bash effectively runs:

sudo apt update

It’s useful when you simply forgot sudo — see our comprehensive guide to the Linux sudo command for more on how it works.

There are other history expansions worth knowing too.

For example:

!1042

runs command number 1042 from your shell history.

These shortcuts are especially convenient when you’ve just typed a long command and don’t want to re-enter it manually.

7. Ctrl+A and Ctrl+E — Move Around a Long Command

Not every useful Linux shortcut is a command.

Bash uses Readline for editing command lines, and a few keyboard shortcuts are worth memorizing.

Ctrl + A

Moves the cursor to the beginning of the command line.

Ctrl + E

Moves the cursor to the end.

Ctrl + U

Deletes everything from the cursor back to the beginning of the line.

For example, imagine you’ve typed a long command and notice that the first option is wrong.

Instead of holding the left arrow key for several seconds, press:

Ctrl + A

and you’re immediately at the beginning.

These shortcuts take a little time to become muscle memory, but once they do, editing long commands becomes much less annoying — they’re the kind of small habit that separates casual users from people who master shell techniques like a senior engineer.

8. nohup command & — Keep a Job Running After SSH Disconnects

This one is particularly useful if you regularly work on remote Linux servers.

Suppose you’re connected over SSH and start a long-running task:

python3 migrate.py

Then your SSH session drops.

Depending on how the process was started and how it is connected to the terminal, the job may receive SIGHUP and terminate.

For a simple detached job, you can use:

nohup python3 migrate.py > migration.log 2>&1 &

There are three important pieces here:

  • nohup prevents the process from receiving the usual hangup behavior.
  • > migration.log redirects standard output to a file.
  • 2>&1 sends standard error to the same file.
  • & puts the command in the background.

You can then disconnect from SSH without keeping the terminal open just to wait for the command. If you work over SSH often, it’s worth reading up on advanced SSH techniques and other ways to simplify your daily SSH routine.

By default, nohup may use nohup.out when output isn’t redirected, so explicitly choosing a log file is usually clearer.

For production workloads, though, systemd, a job scheduler, or another proper process manager is generally a better choice than using nohup as a permanent service solution.

9. tee — Watch Output and Save It at the Same Time

Sometimes you want to see command output while also keeping a copy of it.

Normal redirection:

make build > build.log

writes the output to the file, so you don’t see the normal output in your terminal.

tee lets you do both:

make build | tee build.log

Now the output appears on the screen and is also written to build.log.

To append instead of overwrite:

./script.sh | tee -a runtime.log

This is particularly useful when troubleshooting builds, scripts, deployments, and other commands where you want to watch what is happening while keeping a log for later — a good companion to journalctl for system logging in Linux when you want your own record of what happened, not just what’s in the system journal.

It’s one of those commands that looks simple but becomes surprisingly useful once you start using it.

10. history | grep — Find Commands You’ve Already Used

If you’ve been using Linux for a while, your shell history can contain thousands of commands.

Scrolling through all of them isn’t practical.

You can search it with grep:

history | grep "docker run"

For example, this can help you find an old Docker command without trying to remember exactly when you ran it. If you’re not already comfortable with grep, it’s worth a look at this quick guide to searching text with grep.

If you know the history number, you can execute it directly:

!1042

Another option is reverse history search:

Ctrl + R

Start typing part of the command, and Bash searches backward through your history.

For me, Ctrl + R is often faster than remembering the exact command or searching through the history manually.

A Few Small Tricks Can Change Your Workflow

None of these commands is complicated.

That’s probably why they’re easy to overlook.

But when you’re working in a terminal every day, small conveniences tend to compound. Avoiding one repeated command isn’t a big deal. Avoiding that repetition dozens of times a day is different.

The same goes for preventing a script from hanging, keeping a remote job alive after an SSH disconnect, or finding a command you used three weeks ago.

You don’t need to memorize all 10 at once. Pick one or two that match the kind of work you do and start using them.

Before long, they become part of your normal shell workflow. If you want more in the same spirit, see these underrated Linux commands that deserve more attention and other Linux tips and tricks worth knowing.

What’s the Linux command or shell shortcut you use most often that isn’t obvious to beginners? Share it in the comments.

Avatar photo
David Cao

David is a Cloud & DevOps Enthusiast. He has years of experience as a Linux engineer. He had working experience in AMD, EMC. He likes Linux, Python, bash, and more. He is a technical blogger and a Software Engineer. He enjoys sharing his learning and contributing to open-source.

Articles: 722

Leave a Reply

Your email address will not be published. Required fields are marked *