11 Little-Known Terminal Tricks Every Linux User Should Try

If you click our links and make a purchase, we may earn an affiliate commission. Learn more

Linux has hidden tricks that can make your life easier and more efficient. Even if you are an experienced user, there is always something to learn in Linux. I found several tricks that save you time, reduce repetitive tasks, and improve your user experience.

These little-known terminal commands can help you boost productivity, improve multitasking, and navigate the system more effectively. From managing background processes to creating shortcuts, these tricks will enhance the Linux experience.

To help you make the most of your Linux experience, I’ve compiled 11 little-known terminal tricks every user should try – from backgrounding commands to creating custom shortcuts.

If you need help with Linux, I’ve got something that can help you right away!
Download my free Linux commands cheat sheet – it’s a quick reference guide with all the essential commands you’ll need to get things done on your system. Click here to get it for free!

Run Commands Without Saving Them to History

For this first spot on the list, we’ll consider your privacy. Every command you execute, whether through SSH or directly in the terminal, is logged in your history command. This poses a security risk if someone gains access to those logs.

But! no worries. Fortunately, you can prevent a command from being recorded by simply adding a space before it. Just like that, a single space before the command keeps it out of your history.

Let’s take the following example, we have the same command, but after applying this technique we can see the difference:

Keep in mind that this is controlled by the HISTCONTROL variable in your .bashrc file. If the value is set to ignoreboth (the default), then commands starting with a space won’t be saved. However, if this setting is changed, commands with spaces may still appear in your history:
nano ~/.bashrc

Note: The .bashrc is a hidden file, so you will need to use the command ls -a to see it. It is always stored in each user’s home folder (home/<user>).

Tip: Command lines can be a pain to memorize. I put the essential Linux commands on a printable cheat sheet so you don't have to keep googling them. You can grab the PDF here if you want to save some time.

Always Forgetting Linux Commands?
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.

Download now

Master Multitasking With Screen & Tmux

Sometimes, you run multiple tasks or keep a command running even when you disconnect from your session. Opening multiple SSH connections isn’t always efficient, and that’s where Tmux and Screen come in.

These tools allow you to create “sessions” where you can run multiple commands, split your screen, and keep processes running even after you detach from the session.

Prefer reading without ads and popups?
Members get an ad-free version of every guide, plus exclusive project support.
Join the Community | Sign In

Both tools can be found by default in the installation of any Linux distribution, but wait! You need to keep in mind that the screen is already deprecated and no longer updated compared to tmux which keeps getting updates and support.

Open a Text Editor Instantly

If you find yourself frequently opening nano or vim, here’s a trick to speed things up. Instead of typing the command every time, use this shortcut:

You can press CTRL + X + E, and, it will open by default nano (that has more tricks than you think) where you can immediately start editing a file, script or any text:

Note: This shortcut only works in a direct terminal session (in your device), and it won’t work in most of SSH clients.

Concatenate Commands Using Pipelines and Argx

This is an advanced trick that surely those who have worked with Linux for a long time recognize. Although it is used in different ways, it may be unknown to some people or unintelligible because at first glance you may not understand correctly how to apply them.

First, pipelines (|) allows you to redirect the output of one command as the input of another. This can be usually used for filtering data, but can be used as well for automating tasks and chaining commands together:

Count the Number of .txt Files in a Directory
  • ls *.txt lists all .txt files in the current directory.
  • wc -l counts the number of lines, effectively telling you how many .txt files exist.

Next, another useful command for handling output is xargs. Using xargs allows you to take the output of one command and use it as arguments for another command. This is particularly useful when working with multiple files or items in a single operation:
ls *.log | xargs rm

Always Forgetting Linux Commands?
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.

Download now
List logs files and delete them

Send Any Running Command to the Background

Sometimes, you start running a command only to realize it will take much longer than expected. If you forgot to add an ampersand (&) at the end of the command to run it in the background, you don’t have to stop and restart it—you can send it to the background without interrupting it.

Steps:

  1. Pause the command: Press CTRL + Z. This suspends the running process.
  2. Send it to the background: Type bg and press Enter. The process will continue running in the background.
  3. View background jobs: Type jobs to see a list of processes running in the background.
  4. Bring a job back to the foreground: Use fg followed by the job number (e.g., fg %1) to resume it in the foreground.

Note: If you know from the start that a command will take time, you can start it in the background immediately by appending & or by using screen/tmux and detaching the session.

Execute Multiple Commands at Once

Performing everyday tasks in Linux means they are repetitive, but that doesn’t mean they are performed the same way. Thanks to Linux, you can simplify the process. It allows you to chain multiple commands together in a single line using logical operators.

If you want to run one command only if the previous one was successful, use &&:
sudo apt update && sudo apt upgrade

We have another case, in which we do not care about the result of the command themselves. If you want to run multiple commands no matter what, use ; between commands:
apt update; sudo apt upgrade

Now, sudo apt upgrade will be executed even if apt update fails:

Note: There is a particular case using || which allows us to execute a command and proceed with another command only if the previous one did not work, it is not something common when using the CLI, but useful when making bash scripts.

Search Through Your Command History Instantly

Need to find a command you ran weeks ago? Or maybe you don’t remember it correctly, but you know some essential keywords. Then this solution could be perfect for you, use this shortcut:

Press CTRL + R and start typing a part of the command to search through your command history. Then you will notice that part of your command will be autocompleted but if you want to be more specific you can even write more.

Always Forgetting Linux Commands?
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.

Download now

Let’s see this example. I already ran this command in the previous section, and if I only search “ping“, the first result will be the one we already used for testing the connection to raspberrypitips.com just like this:

This only works if the command is still on your history. If your history was cleared, you won’t be able to retrieve any command.

Adjust the Font Size of Your Terminal

Sometimes, depending on your SSH or terminal settings, you may find your font too large or too small, which can be annoying if you are working for long hours and can strain your eyes. You can quickly adjust it using simple keyboard shortcuts.

Adjust Font Size Using These Shortcuts:

  • Reset to default size: CTRL + 0
  • Increase font size: CTRL + +
  • Decrease font size: CTRL +

This is particularly useful if you’re working on a high-resolution display, where text might be too small to read comfortably. Similarly, on smaller screens, reducing font size can help fit more information in the terminal window.

Freeze and Unfreeze Your Terminal

Have you ever accidentally locked your terminal and couldn’t type anything? Or maybe you want to prevent someone from tampering with your session? There’s a simple trick to freeze and unfreeze your terminal.

To freeze the screen you have to input the key combination CTRL + S, and your screen will be completely frozen and nothing will be displayed even if you type in. If you want to use it again, use CTRL + B to return your screen to normal.

This is useful in environments where multiple users have access to your system. If you need to step away momentarily, freezing the terminal ensures no unintended inputs occur.

Create Custom Aliases for Frequent Commands

Always Forgetting Linux Commands?
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.

Download now

We talk about being more effective when performing daily tasks and how to simplify them, but sometimes it is not enough to start different commands on the same line, if the command is long enough it is more likely to make mistakes or to get tired typing it.

Guess what? that’s a perfect situation for using aliases. When using an alias, you can assign a name to a complete command you usually use. To do this, the first thing to do is to edit the .bashrc file located in your user folder, and add the following line at the end:

For example, we assigned an alias to the command ping 8.8.8.8 with the name “pingtest“, mostly because it is a common test we always do for checking the internet connectivity. When using it, you can see the exact command and arguments defined previously:

Note: The .bashrc file can be used for other purposes as well, to run programs on startup or for charging the font of the terminal.

Related: Top 25 Raspberry Pi Tips and Tricks You’ll Actually Use


🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Want to connect with other Raspberry Pi fans? Join the RaspberryTips Community. Ask questions, share your projects, and learn from each other. Join now.

Navigate Through Your Command Line With Shortcuts

We have already seen how to be more efficient with repetitive or long commands, but you can also be more efficient when you use the CLI. Hotkeys are not only intended to open apps, increase/reduce font or freeze the screen but can also be used to navigate thought your CLI.

There are a variety of hotkeys, for moving to the beginning/end of the line, moving between characters, or deleting an entire line and any other functionality. Here is a list of the most important hotkeys that you can use for your day-to-day:

  • Move to the beginning of the line: CTRL + A
  • Move to the end of the line: CTRL + E
  • Delete everything before the cursor: CTRL + U
  • Delete everything after the cursor: CTRL + K
  • Clear the entire line: CTRL + L

For more terminal tips and tricks, check out our other related tutorials:

Mastering these tricks will make your daily Linux experience smoother and more efficient. Keep exploring, and you’ll always find new ways to improve your workflow! There is always something to learn in Linux.

Whenever you're ready, here are other ways I can help you:

Master Linux Commands: Overwhelmed with Linux commands? This book is your essential guide to mastering the terminal. It includes practical tips, real-world examples, and a bonus cheat sheet to keep by your side.

The RaspberryTips Community: Need help with Linux or want to chat with people who actually get it? Join the RaspberryTips Community and get access to private forums, exclusive lessons, and direct support.

You can also find all my recommendations for tools and hardware on this page.

Similar Posts