Ubuntu

Ubuntu Terminal Shortcuts

The command-line is an integral part of any Linux/UNIX system. It offers the utmost control over every single aspect of the system. However, working with the command-line can be cumbersome, sluggish, and annoying. To speed things up and improve the user experience, keyboard shortcuts are undeniably effective.

In this guide, we will dive into the wonderful world of keyboard shortcuts available for the terminal in Ubuntu.

Prerequisites

To perform the steps demonstrated in this guide, you will need the following components:

Ubuntu Terminal Emulator

GNOME is the default desktop environment on Ubuntu. Whenever interacting with the terminal, you are actually interacting with GNOME Terminal which is the default terminal emulator of the GNOME desktop. Thus, this guide will mostly focus on shortcuts available on GNOME Terminal on Ubuntu.

If you are using a different terminal emulator, then check its documentation for configuring keyboard shortcuts. However, some of the shortcuts of GNOME Terminal will overlap with others.

GNOME Terminal Shortcuts

Here is a list of terminal shortcuts specific to GNOME Terminal:

Window and Tab Management

  • Open a new tab: Shift + Ctrl + T
  • Closing a tab: Shift + Ctrl + W
  • Opening a new window: Shift + Ctrl + N
  • Closing a window: Shift + Ctrl + Q

Copy and Paste

  • Copying the selected text: Shift + Ctrl + C
  • Pasting text from clipboard: Shift + Ctrl + V

Window Size

  • Full screen (or exit full screen): F11
  • Zoom in: Ctrl + +
  • Zoom out: Ctrl + –
  • Revert back to original size: Ctrl + 0

Searching

  • Find any text: Shift + Ctrl + F
  • Find next instance: Shift + Ctrl + G
  • Find previous instance: Shift + Ctrl + H
  • Clear highlight: Shift + Ctrl + J

Tab Switching

  • Switch to the next tab: Ctrl + Page Down
  • Switch to the previous tab: Ctrl + Page Up
  • Reposition the current tab to the right: Shift + Ctrl + Page Down
  • Reposition the current tab to the left: Shift + Ctrl + Page Up
  • Switch to tab 1: Alt + 1
  • Switch to tab 2: Alt + 2
  • Switch to tab 3: Alt + 3
  • Switch to tab 4: Alt + 4
  • Switch to tab 5: Alt + 5
  • Switch to tab 6: Alt + 6
  • Switch to tab 7: Alt + 7
  • Switch to tab 8: Alt + 8
  • Switch to tab 9: Alt + 9
  • Switch to tab 10: Alt + 0

Scrolling

  • Scroll to the top: Shift + Home
  • Scroll up by one page: Shift + Page Up
  • Scroll up by one line: Shift + Ctrl + Up
  • Scroll down by one line: Shift + Ctrl + Down
  • Scroll down by one page: Shift + Page Down
  • Scroll to the bottom: Shift + End

Bash Shortcuts

In most Linux distros (including Ubuntu), Bash is the default shell. The following keyboard shortcuts are specific to Bash (not the terminal emulator). So, these ones should act the same across all terminal emulators.

  • Erasing a word: Ctrl + W
  • Go to the start of the line: Ctrl + A
  • Go to the end of the line: Ctrl + E
  • Go back one character: Ctrl + B
  • Go back one word: Alt + B
  • Go forward one character: Ctrl + F
  • Go forward one word: Alt + F
  • Delete from the cursor to the end of the line: Ctrl + K
  • Delete from the cursor to the start of the line: Ctrl + U
  • Delete from the cursor to the start of the word: Ctrl + W
  • Delete the last word: Alt + Backspace
  • Paste text: Ctrl + Y
  • Clear the screen (leaves only the current line at the top): Ctrl + L
  • Scroll back to previous commands: Up arrow key
  • Start a reverse search through the Bash history: Ctrl + R
  • Start a forward search through the Bash history: Ctrl + S
  • Quit reverse/forward searching: Ctrl + G
  • Suspend the current foreground process in the background: Ctrl + Z
  • Stop the current foreground process/command (sends SIGINT to stop): Ctrl + C
  • Exit the shell (equivalent to the exit command): Ctrl + D

There are more complex keyboard shortcuts that Bash supports by default. Check out a more comprehensive list of Bash keyboard shortcuts

Custom Keyboard Shortcuts

We have learned about the default shortcuts of the Ubuntu terminal. However, we can also set custom keyboard shortcuts for different actions.

To create a custom shortcut, first, open GNOME Terminal:

Next, click the menu button from the top-right corner and select “Preferences”:

From the new window, go to “Shortcuts”:

Ensure that the option “Enable shortcuts” is enabled:

From the list, select the desired action you wish to edit. Then, click the key combination you wish to set as the shortcut key:

The new shortcut is automatically saved. It should now appear on the list of available shortcuts:

When using this approach, there are a couple of things you should keep in mind:

  • Almost any key combination is allowed as a shortcut. The keys that you can use include Alt, Ctrl, Shift, Super, numbers, and letters.
  • Mnemonic key combinations are not allowed as shortcuts.
  • Make sure that the new shortcut doesn’t conflict with any existing shortcut.

Disabling a Shortcut

GNOME Terminal also allows disabling keyboard shortcuts for a certain action. To disable a shortcut, return to the “Shortcuts” section from “Preferences”:

Select the shortcut you wish to disable and press “Backspace”. This will remove the existing shortcut key combination:

The action is now disabled as there is no keyboard shortcut to trigger it.

Conclusion

We discussed the keyboard shortcuts available on the Ubuntu terminal. We also discussed the keyboard shortcuts to perform various Bash actions. Keyboard shortcuts, if mastered, can speed up various tasks by a noticeable amount.

Interested in learning more shortcuts? Then the Vim text editor is a treasure trove for you. It’s full of keyboard shortcuts, commands and abbreviations, plugins, and more. According to many advanced users and enthusiasts, Vim can actually be faster and more efficient to use than traditional text editors.

About the author

Sidratul Muntaha

Student of CSE. I love Linux and playing with tech and gadgets. I use both Ubuntu and Linux Mint.