How to paste into terminal

Linux users that are new to using the command line terminal will quickly realize that the typical and well known Ctrl + C and Ctrl + V keyboard shortcuts do not work for copying and pasting. Instead, Ctrl + C will interrupt a running command, so users must quickly make new habits and learn the proper way to copy and paste into the terminal. In this tutorial, we will show you all the ways to paste your clipboard into the terminal on a Linux system. We will also go over a few ceveats that you may need to know.

In this tutorial you will learn:

  • How to paste text into terminal via keyboard shortcut
  • How to paste text via right click context menu
  • How to paste text via mouse button shortcut
  • How to copy text from terminal with mouse or keyboard
How to paste into terminal
How to paste into terminal
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to paste into terminal




Here are the various ways to paste your clipboard into a Linux terminal, and other various keyboard shortcuts or information that will also be relevant.

DID YOU KNOW?
The Ctrl + C keyboard shortcut, which sends an interrupt signal on Linux, was around before it was ever used by other applications and operating systems as a method to copy text or files to a clipboard. So, you will find that Ctrl + C and Ctrl + V work in all other contexts on your Linux system, but not in the terminal.
  1. To paste copied text into your Linux terminal, use the Ctrl + Shift + V keyboard combination. In other words, hold down Ctrl and Shift simultaneously, and then tap the V key, and your copied text will be pasted into the terminal.
  2. In the case that you are on a system that will also accept mouse input, you can click on the middle scroll wheel button to paste your copied text. Rather than going through the usual process of copying text, you can just highlight whatever you want in your terminal, then click the middle mouse button to paste it.
  3. It is also handy to know that the Ctrl + Shift + C keyboard combination will copy any highlighted text to your clipboard, which can then be pasted later.
  4. If you are using a desktop environment, such as GNOME, you should be able to right click in your terminal emulator and access both the copy and paste functions.
    Using the copy and paste options from the right click context menu
    Using the copy and paste options from the right click context menu
  5. Your terminal emulator also most likely has a menu that contains both the copy and paste functions in it. Check the drop down menu to see if this option is there.
  6. Note that various terminals may have differently configured keyboard shortcuts. The Ctrl + Shift + V keyboard combination should work in almost all possible scenarios, but you will need to check your terminal emulator to see if this shortcut is configured, or to set up your own custom one.
    Accessing a list of keyboard shortcuts used in our terminal emulator
    Accessing a list of keyboard shortcuts used in our terminal emulator

Closing Thoughts




In this tutorial, we saw how to paste text into the command line terminal on a Linux system. For new users, it is common to keep trying Ctrl + C and Ctrl + V, before realizing that these shortcuts do not do what you think they should. After learning the proper keyboard shortcuts and alternative methods mentioned here, you will be able to quickly and efficiently manipulate text in your terminal. Just remember to check your terminal emulator’s settings for more configuration.



Comments and Discussions
Linux Forum