linux keyboard shortcuts

13 Linux Terminal Shortcuts You’ll Wish You Knew Earlier

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

I’ve been using Linux for years, but using the command line when you only have a text prompt can be tedious. Wouldn’t it be great if there were simple ways to save time when typing commands? There are, and that’s what I will show you today.

Hidden keyboard shortcuts in the Linux terminal can make work go faster, fix mistakes quicker, and save time from repeatedly typing the same thing.

In this article, I’ll show you my favorite ones, making you wonder why nobody told you sooner. They’ll be accompanied by example terminal screenshots so you can practice using them. Let’s go through them individually so you can start using them today.

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!

Jump to the Beginning or End of the Line

Holding down the left and right arrow keys to navigate through them can be frustrating when working with long Linux commands. For instance, if you write a lengthy command and notice a typo in the first few characters, it can be tedious to scroll to the beginning to fix it.

You can use the following keyboard shortcuts to quickly jump to the beginning or the end of the line:

  • Ctrl + A – Jump to the beginning of the line.
  • Ctrl + E – Jump to the end of the line.

Using these shortcuts can significantly reduce the time spent navigating lengthy commands.

Quickly Navigating Through a Command

You probably already know you can use the Left and Right keyboard keys to navigate through a command and then use Backspace to delete characters from a command. But did you know you can modify this behavior to skip complete words, instead of individual characters?

You can use the Ctrl key to modify the behavior of the Left and Right keys to move over complete words instead of individual characters:

  • Ctrl + left – Skip cursor one word to the left.
  • Ctrl + right – Skip cursors one word to the right.

Once you start using this shortcut, it will become second nature, and your overall efficiency with the Linux terminal will improve drastically.

Delete One Word at a Time

How often have you needed to modify a command you’ve cut and pasted into a Linux terminal? Typically, you must hold backspace and retype the parts you want to change.

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

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

Two keyboard shortcuts can be used to delete a word and then paste it back.
These shortcuts are:

  • Ctrl + W – Delete the last word (between two spaces).
  • Ctrl + Y – Paste the last deleted word.

These shortcuts can also move a word from one place to another. You can delete a word, then move your cursor to a new location and paste the deleted word there.

Note: Want to follow along as you learn the basics of using a terminal? I have a video lesson on this topic just for community members. Join here to watch, and get access to 30+ other lessons for Raspberry Pi along with many other benefits!

Delete Everything After or Before the Cursor

A helpful shortcut for editing long commands efficiently is the ability to delete a portion of your command in bulk. Instead of deleting each character one by one, you can position your cursor at the desired location and delete everything either after or before that point.

To do so, you can use these shortcuts:

  • Ctrl + K – Delete from the cursor to the end of the line.
  • Ctrl + U – Delete from the cursor to the start of the line.

Combine this with Ctrl + W, Ctrl + Y, and Ctrl + _, and your efficiency at editing long commands will improve drastically.

Undo the Last Typing Action

One useful functionality is the ability to undo changes made to a command. Typically, when you make a mistake, you need to Backspace and retype the command.

Instead, you can use the shortcut Ctrl + _ (underscore) to quickly undo the changes made.

This command can come in handy when working with complex commands that require a lot of tweaking or editing.

Edit the Previous Command in an Editor

Typing long commands in the terminal can be tedious when using Linux, especially when navigating and editing complex, multiline commands. It can be very convenient to edit these commands in a text editor of your choice.

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

Download now
  • You can achieve this functionality using the shortcut Ctrl + X + E.
  • This combination will open a text editor, allowing you to edit the last command.
  • Once you exit the text editor, the command will be executed.

You can change this command’s default terminal editor by changing the $EDITOR environment variable. For example, to use vim instead of nano, you can use this command:
export $EDITOR=vim

To switch back to nano, you can use this command:
export $EDITOR=nano

Similarly, you can use any other editor that you are comfortable with.

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.

Autocomplete File Names and Commands

One frequently used shortcut is pressing Tab to autocomplete commands. This feature is helpful when navigating your file system, allowing you to enter the most relevant folder or file names automatically.

All you have to do is start typing a command and press Tab to autocomplete.

Sometimes, when there is more than one option for the autocomplete, you can press Tab over and over again to cycle through all the possible options.

Re-Run a Command Without Typing It Again

When working in a Linux terminal, I frequently need to reuse commands I’ve entered previously. Instead of repeatedly typing the same command, I use a shortcut to quickly scroll through all the commands I’ve run in the past.

You press the Up and Down keys to scroll through the commands you have typed in your terminal.

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

Download now

This shortcut is essential in my workflow; once mastered, it’s indispensable.
I also like to use the history command to go back even further in time.

Recall the Last Argument Used

In a Linux terminal, you often repeatedly use the same argument with different commands. For instance, after creating a directory with mkdir, you may need to change into that directory with cd.

Ctrl + . will automatically insert the last used argument at the cursor position.

Another helpful trick with this shortcut is scrolling through all previously used arguments. You can navigate through all the arguments you’ve used before by repeatedly pressing this shortcut.

Quickly Search Through Previous Commands

Another way to use a command you have already used in your Linux terminal is to search for it instead of scrolling. This can be particularly useful when looking for a command you used some while ago.

Press Ctrl + R to open the search menu and type the command to search.

To search for a command, you must type a part of it in the exact sequence it appears in. This part can be located anywhere within the command. However, it must match the actual command exactly; fuzzy searching is not used.

You can also press Esc to enter the command in the terminal instead of automatically running it (if you want to edit a portion of it before executing).

Clear the Screen Instantly

In a Linux terminal, the output from various commands can quickly clutter my screen, making it difficult to focus on my tasks. Typically, the clear command will wipe clutter from the screen.

Alternatively, you can also use the Ctrl + L keyboard shortcut to clear the screen.

Cancel or Kill a Command Instantly

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

Download now

Some Linux commands can execute a hanging process, which prevents further input into the terminal until the command finishes. Sometimes, it may be necessary to terminate that command prematurely.

You can cancel a command by pressing Ctrl + C.

This can also help stop a command that you have executed mistakenly.


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

Stuck on this project? Ask me or other Pi users in the RaspberryTips Community. We help each other out and you'll get answers quick. Join and fix it together.

Freeze and Unfreeze the Terminal

Several Linux commands provide real-time feedback and display. For instance, when using tools like top, it can be helpful to freeze and unfreeze your terminal to read the constantly changing output carefully.

You can use the following shortcuts to freeze or unfreeze your terminal:

  • Ctrl + S – Freeze the terminal output.
  • Ctrl + Q – Unfreeze the terminal.

These shortcuts can also be helpful if you want to pause a command’s output to read an error code carefully.

That’s all for today. For more terminal tricks, check out our related articles:

Mastering these shortcuts will save you so much time. Try using a few today, and you’ll wonder how you ever worked without them.

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