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.
In this quick Linux guide, you will learn how to copy and paste text in the Linux Terminal. For the demonstration, we will be using the Ubuntu 20.04 LTS. The same method can be followed in other Linux distributions.
Using 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.
Using the Mouse Right-click
You can also copy-paste in Terminal using the mouse right-click as you normally do with other applications. For instance, to copy any line from Terminal, select it and right-click it. Then pick Copy from the list of options that pop-up. Now the selected line will be copied.
Now to paste the copied line in the Terminal, again right-click and select Paste.
Now you will see the pasted line on the Terminal.
This is how you can copy and paste text in the Linux Terminal. I hope you will find this quick guide helpful as it saves the time that spends in typing the long commands and text.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.