How to Copy and Paste Commands in the Linux Terminal?

In Linux, the copy-pasting method is slightly different compared to other operating systems, like windows. Usually, we use the “Ctrl+c” and “Ctrl+v” in the windows operating system, whereas these shortcut keys don’t work in Linux operating systems. To copy and paste the commands in Linux, there are three methods.

This article will illustrate the methods for copying and pasting commands in a Linux terminal. The content for the post is:

Let’s start with the first copy/paste method.

Method 1: Copy and Paste Commands By Right-Clicking in the Linux Terminal

To copy the commands in Linux using right-click, select the command, press the right click and hit the “copy” option:

The command will be copied.

To paste the command in the terminal, press right-click and click on the “paste” option:

After clicking on the “paste” option, the command will be pasted in the terminal:

The command has been pasted.

Method 2: Using Keyboard Shortcuts in the Linux Terminal

The second way to copy-pasting the command into the terminal is to use the keyboard shortcut keys, “Ctrl+Shift+C” or “Ctrl+Insert” for copying, and for pasting, use the “Ctrl+Shift+V” or “Shift+Insert”. Select the command and press “Ctrl+Shift+C” or “Ctrl+Insert” from the keyboard:

The command will be copied.

Now, to paste the copied command, press “Ctrl+Shift+V” or “Shift+Insert” in the terminal:

The command will be pasted.

Method 3: Using the Middle button of the Mouse

Another method to copy the commands in the terminal is using the mouse’s middle button (scroll). It will automatically copy and paste the command into the terminal. The implementation of this method is shown in the “GIF”:

The command will automatically be copied and pasted.

Why Does Linux not use “Ctrl+C” for Copy?

Linux uses the “Ctrl+C” shortcut key not for copying the command in the terminal but to terminate the execution of commands:

The above image shows that the process is terminated by pressing “Ctrl+C” in the terminal.

Note: Apart from the terminal, the user can use the “Ctrl+C” and “Ctrl+V” for copying and pasting the files.

The methods for Copying and pasting the commands in the Linux terminal have been covered.

Conclusion

There are three ways to copy and paste the command in the Linux terminal: use the right-click of the mouse, the middle button, or press the keyboard shortcut keys. Press the “Ctrl+Shift+C” or “Ctrl+Insert” for copying, and for pasting, press the “Ctrl+Shift+V” or “Insert+V” from the keyboard or use the mouse buttons (right-click and middle). This write-up has illustrated the methods for copying and pasting the command in the terminal.