Linux paste into terminal

How to Copy Paste in Linux Terminal [For Absolute Beginners]

Here are various ways to copy paste text and commands in Linux terminal along with explanation on why Ctrl+C and Ctrl+V doesn’t work in the terminal.

I have been using Linux for a decade now and this is why sometimes I take things for granted. Copy-pasting in the Linux terminal is one such thing. I thought everyone already knew this until one of the It’s FOSS readers asked me this question. I gave the following suggestion to the Ubuntu user:

Use Ctrl+Insert or Ctrl+Shift+C for copying and Shift+Insert or Ctrl+Shift+V for pasting text in the terminal in Ubuntu. Right-click and select the copy/paste option from the context menu is also an option.

I thought of elaborating on this topic especially when there is no single universal way of copying and pasting in the Linux terminal.

How to copy and paste text and commands in the Linux terminal

Method 1: Using keyboard shortcuts for copy-pasting in the terminal

On Ubuntu and many other Linux distributions, you can use Ctrl+Insert or Ctrl+shift+C for copying text and Shift+Insert or Ctrl+shift+V for pasting text in the terminal. The copy-pasting also works for external sources. If you copy a command example from It’s FOSS website (using the generic Ctrl+C keys), you can paste this command into the terminal using the Ctrl+Shift+V into the terminal. Similarly, you can use Ctrl+shift+C to copy text from the terminal and then use it to paste in a text editor or web browser using the regular Ctrl+V shortcut. Basically, when you are interacting with the Linux terminal, you use the Ctrl+Shift+C/V for copy-pasting.

Method 2: Using right-click context menu for copy-pasting in the terminal

Another way of copying and pasting in the terminal is by using the right-click context menu. Select the text in the terminal, right click and select Copy. Similarly, to paste the selected text, right-click and select Paste.

Method 3: Use the mouse to copy and paste into the Linux terminal

Another way to copy-paste in a Linux terminal is by using only the mouse. You can select the text you want to copy and then press the middle mouse button (scrolling wheel) to paste the copied text. Please keep in mind that these methods may not work in all the Linux distributions for a specific reason that I explain in the next section.

Why Linux terminals do not use the ‘universal’ Ctrl+C and Ctrl+V for

No Linux terminal will give you Ctrl+C for copying the text. This is because by default Ctrl+C keybinding is used for sending an interrupt signal to the command running in the foreground. This usually stops the running command. This behaviour has been existing long before Ctrl+C and Ctrl+V started being used for copy-pasting text. Since the Ctrl+C keys are ‘reserved’ for stopping a command, they cannot be used for copying.

Читайте также:  Apache server configure in linux

Used Ctrl+S and hanged the terminal?

The keyboard shortcut CTRL + S in the Linux terminal is used to send a «stop» signal to the terminal, which results in a frozen terminal. Just use Ctrl+Q and you can use the terminal again.

There are no universal key shortcuts for copy-paste in the Linux terminal. Here’s why!

Change Keyboard Shortcuts in GNOME Terminal Preferences

The keybindings for copy-pasting are dependent on the terminal emulator (commonly known as terminal) you are using. If you didn’t know that already, a terminal is just an application, and you can install other terminals like Guake or Terminator. Different terminal applications may have their own keybindings for copying and pasting like Alt+C/V or Ctrl+Alt+C/V. Most Linux terminals use the Ctrl+Shift+C/V keys but if it doesn’t work for you, you may try other key combinations or configure the keys from the preferences of the terminal emulator.

Conclusion

I know this is elementary for the Sherlock Holmes of the Linux world but it could still be useful to the Watsons. If you are absolutely new to the terminal, this is going to help you a great deal. New or not, you may always use shortcuts in the Linux terminal to make your life easier. If you really care about increasing productivity through the Linux terminal, these handy Linux command tips and tricks will be a good starting point. 💬 Do you still have questions? The comment section is all yours.

Источник

How to copy-paste on Ubuntu terminal

In user-interface design and human-computer interaction, copy-paste are operations that provide an interprocess communication mechanism for moving data via the user interface of a system. The copy command duplicates the data and saves it to temporary storage (the clipboard). Then this data from the clipboard is pasted into the desired location. The copied data is accessible to any program that supports the functionality and allows itself to transfer data easily.

You may need to write long commands or sentences obtained in a file or on the internet while working on the Ubuntu terminal. You can save your precious time by utilizing copy-pasting techniques rather than entering them word by word. Using the standard keyboard commands Ctrl+c and Ctrl+v, you may have copied and pasted text multiple times in your Ubuntu Graphical User Applications such as LibreOffice, Gedit, OpenOffice. However, you may be surprised to learn that many common keyboard shortcuts do not work in Ubuntu Terminal.

This article will show you how to copy-paste in the Ubuntu terminal using two different methods. The examples below are executed on Ubuntu 20.04; other Linux distributions can also use the same copy-paste approach. Now, let’s get started!

How to copy-paste on Ubuntu terminal using right-click context menu

You need to utilize the mouse to highlight the text; why not use it to copy and paste? You can use the mouse right-click for copy-paste as you do in other Ubuntu applications. For this, select the text you want to copy, then right-click on it, and from the context menu, click on the “Copy” option. You can paste this copied command to the terminal window, any script, or any other document.

Example 1: In the below-given example, we will copy-paste the command executed in the Ubuntu terminal to a document named “testscript”:

Firstly, we have selected the command. After that, utilizing the right-click context menu, we will click on the “Copy” option:

Читайте также:  Python gui linux windows

Now, we will paste the copied command in our “testscript” document. Click on the document position, where you want to place the copied command, and then from the right-click context menu, click on the “Paste” option:

Example 2: In Ubuntu, you can also use your mouse’s context menu right-click to copy-paste from a terminal to the other terminal window. For this, select the command and click on the “Copy” option:

Move into the other terminal and paste the selected command in the following way:

How to copy-paste on Ubuntu terminal using keyboard shortcuts

Most computer users are accustomed to using “CTRL+c” and “CTRL+v” for copy-pasting text. These shortcuts also work on Ubuntu Desktop, but not in the terminal. To copy or paste commands from or to the Ubuntu terminal, you must add the “Shift” key in these keyboard shortcuts.

  • To copy text or command from Ubuntu terminal, press “CTRL+Shift+c
  • To paste text or command in Ubuntu terminal, press “CTRL+Shift+v
  • To copy text or command from outside of the Ubuntu terminal, press “CTRL+c
  • To paste text or command in any document or script, press: “CTRL+v

Example 1: In the below-given example, we will try to copy commands from the document “testscript” to our Ubuntu terminal:

First of all, we will select all of the required commands for copying and then press “CTRL+c”:

After that, we will move towards our terminal window and paste the commands in it by pressing “CTRL+SHIFT+v”:

This operation will paste and execute the copied commands in the terminal simultaneously:

If you paste a command into the Ubuntu terminal with a trailing newline, the command will be executed right away. I have discovered that selecting a command by clicking at the end and dragging it to the beginning is the easiest way to avoid this. We will be able to paste commands in the Ubuntu terminal through this selection method without executing it instantly.

Next, we will select the command from the document by using the method mentioned above. After that, press “CTRL+c” to copy it:

Move into your Ubuntu terminal and press “CTRL+Shift+v” to paste the copied command:

The below-given shows that we have successfully pasted the command from our document to the terminal without executing it instantly:

Example 2: How to copy-paste from Ubuntu terminal to a document using keyboard shortcuts
To copy and paste any command from your terminal window; select it by pointing the cursor at the end of it. After that, utilize the mouse right-click button and drag it towards the start of the command. Once you have selected the command, press “CTRL+Shift+c” to copy it:

Next, open up your document where you want to paste the command and press “CTRL+v”. Now the “testscript” document will look like this:

Conclusion

There are always options to copy-paste in the Ubuntu terminal whenever you find yourself reusing any text. In Ubuntu, copy-paste enables you to copy and paste text or commands without retyping them repeatedly. This process also saves your time, which you can invest in other things. In this article, you have learned how to copy-paste in the Ubuntu terminal using two different methods. According to our experience, using keyboard shortcuts for copy-paste is easier than utilizing the mouse right-click menu.

About the author

Sharqa Hameed

I am a Linux enthusiast, I love to read Every Linux blog on the internet. I hold masters degree in computer science and am passionate about learning and teaching.

Читайте также:  Установка yandex browser linux через терминал

Источник

How to Copy and Paste in Linux and Ubuntu Terminal

When you switch to Linux from Microsoft Windows, especially if you are a programmer, there is a possibility that you might struggle to copy and paste commands or lines in the Linux Terminal window.

Even when I ported to Ubuntu from Windows a decade ago, I struggled to copy and paste lines in the Linux terminal. At that time, I thought I’m the only user struggling to copy and paste. However, while searching on the Internet, I realized that it is a global problem.

The reason is a keyboard shortcut and mouse keys to copy and paste lines in the Linux terminal windows are not the same as the ones we use on Windows.

The key bindings for copy and paste operations are dependent on the specific terminal emulator you are using. In Linux, by default CTRL + C key binding is used for sending an interrupt signal to the command running in foreground. Hence, the Linux terminals do not use the standard CTRL + C and CTRL + V for copy and paste operations.

Using Keyboard Shortcut

On Ubuntu and other Linux distributions, you have to use CTRL + SHIFT + C combination of keys to copy text from a terminal or a text editor.

To copy a text or line of code from the browser, you can use the generic CTRL + C combination or CTRL + SHIFT + C. Then, to paste this line of code into the terminal, you need to use CTRL + SHIFT + V keys.

You have to use these key combinations in Ubuntu to perform copy and paste operations, especially in the Linux Terminal.

Using Mouse Right-Click Context Menu

The other way to copy and paste in the Linux terminal is to use Mouse right key context menu.

To copy the text or line in terminal, select the text then right click and select copy. Now, to paste the selected text, right-click and select paste from context menu.

Using Mouse Middle Key

This method is not so much popular among Linux users but still effective on some Linux distributions. In this method, you need to select the text you want to copy and paste. Then, press the scrolling wheel button, which is the middle button on the mouse, to paste the selected text.

This is how you can copy and paste text in Linux terminal. It is simple yet confusing for new Linux users, especially those switching to Linux from Windows or Mac. The mentioned methods may or may not work in various Linux distributions for the reason mentioned earlier in this article.

Conclusion

The copy and paste commands in the Linux and Ubuntu Terminals are different from Microsoft Windows and Mac. There are three methods to copy and paste in the Linux and Ubuntu Terminal. These methods are the use of the specific keyboard shortcuts, the use of the mouse right-click menu, and the use of the mouse middle key. When you implement the methods provided, you can successfully copy and paste in the Linux and Ubuntu Terminals. I hope this article helped you efficiently use the copy and paste command. To learn more, check out the other articles on LinuxHint.com.

About the author

Swapnil Tirthakar

A Software Engineer who loves football and passionate about traveling. I often spend my free time playing with gadgets and exploring new possibilities in tech world. I am Linux enthusiast and have about 6 years of experience in web development. I have good command on Python, Java, SQL and system security.

Источник

Оцените статью
Adblock
detector