Ubuntu

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.