Copying and pasting is one of the most used actions on a computer.
While it is easy to do so with the Ctrl + C and Ctrl + V keyboard shortcuts, on the Linux terminal it is not so straightforward.
You have several options to get the job done.
Sometimes while working in the Linux command line, you need to type the long commands or texts you found in the file or on the internet.
Instead of typing those commands or text, you can save time by copy-pasting them onto the command line Terminal application.
You may have copy-pasted text several times in your Linux GUI applications ( e.g. in Gedit, LibreOffice, OpenOffice) using the usual keyboard shortcuts Ctrl+c and Ctrl+v.
But you may wonder to know these usual keyboard shortcuts do not work in Linux Terminal.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Linux Terminal related queries.
In this context, we shall look into how to copy and paste text in the Linux Terminal.
How to use the Keyboard Shortcuts ?
Instead of Ctrl+c and Ctrl+v, the shortcuts to copy and paste in the Linux Terminal are Ctrl+Shift+c and Ctrl+Shift+v.
Let's say you want to copy the text or command from a document or webpage and paste it to the Terminal.
To copy the lines from a document or webpage that is open in the graphical application, select them, and press Ctrl+c.
To paste the copied lines into Terminal, press Ctrl+Shift+v.
After that, you will see the pasted lines on the Terminal.
Let's say you want to copy a line or command from the Nano editor and paste it to the Terminal. To copy it from the Nano editor, select it and press Ctrl+Shift+c.
To paste the copied lines to Nano editor or to shell outside Nano editor, press Ctrl+Shift+v. Now you will see the pasted lines on the Terminal.
How to use the Mouse Right-click ?
You can also copy-paste in Terminal using the mouse right-click as you normally do with other applications.
i. For instance, to copy any line from Terminal, select it and right-click it.
ii. Then pick Copy from the list of options that pop-up.
iii. Now the selected line will be copied.
iv. Now to paste the copied line in the Terminal, again right-click and select Paste.
v. Now you will see the pasted line on the Terminal.
This article covers how you can copy and paste text in the Linux Terminal. This saves the time that spends in typing the long commands and text.
When you enter a long command into the Terminal window that you found on the web or in a document, you can save yourself some time by easily copying and pasting the command at the prompt.
To Copy and Paste Text into the Linux Terminal:
1. To begin, highlight the text of the command you want on the webpage or in the document you found.
2. Press Ctrl + C to copy the text.
3. Press Ctrl + Alt + T to open a Terminal window, if one is not already open. Right-click at the prompt and select "Paste" from the popup menu.
4. The text you copied is pasted at the prompt.
5. Press Enter to execute the command.
6. You can also copy text from the Terminal window to paste into other programs.
7. Simply highlight the text, right-click on it, and select "Copy" from the popup menu.
You can paste this text into a text editor, word processor, and so on.