When someone is switching from one platform to another such as Windows and Mac to Linux he must know that different commands are used to perform different functions. For example, if you want to copy and paste the text or command in Linux from terminal to text editor and from text editor to terminal it has a different method as compared to Windows and Mac.  

Copy and Paste a Terminal Command in Linux/Ubuntu

There are different methods used in Linux to copy and past commands in the terminal such as:

  • Use the keyboard shortcuts to copy and paste into the Linux terminal
  • Use the right-click to copy and paste into the Linux terminal 
  • By using the screen command copy and paste the command 

Method 1: Use the Keyboard Shortcuts to Copy and Paste in Linux Terminal

To copy and paste commands in the Linux terminal you can use your keyboard. To copy the command from the Linux terminal, type Ctrl+Shift+C and paste this command by simply using the Ctrl+Shift+V command. The steps to perform the copy and paste by keyboard are given as:

Step 1: Now select the commands of the terminal you want to copy and paste by the keyboard. Now from the keyboard use the command Ctrl+Shift+C to copy the selected portion. 

Step 2: Now paste the copy commands in the text editor by using the command Ctrl+Shift+V from the keyboard. 

Copy From Text Editor to Terminal by Using the Keyboard Command

You need to select the text you want to copy from the text editor by using the command Ctrl+Shift+C

Now press the Ctrl+Shift+V command to paste the copied test in the Linux terminal.

Method 2: Use the Right Click to Copy and Paste in Linux Terminal

The other way to copy and paste in the Linux terminal is by using the right-click menu. You need to select the desired command and simply press right-click on the selected portion it gives you the Copy option then paste the copy command into the text editor.  

Step 1: Now select the commands you want to copy from the terminal by using the mouse. Then right click on it, and then dropdown menu will appear from this menu click on the copy.

Step 2: Now open the text editor and right click on it then click on the Paste option.

Step 3: When you click on the Paste option, then the commands will appear on the text editor as shown below in the figure.

Copy From Text Editor to Terminal by Using the Right Click Option

Step 1: Select the text you want to copy from the text editor and then right click on the selected portion. Now click on the Copy option.

Step 2: Now right click on the terminal of the Linux and simply click on the Paste option.

Step 3: Now after clicking on the Paste option the copied text will appear on the terminal of Linux.

By Using the Screen Program to Copy and Paste the Command 

To perform the task of copy and paste by the screen method first need to install the program known as Screen.

The process to install Screen: You need to execute the command sudo apt install screen. When this program installs you need to execute the command screen in the Linux terminal. The steps to copy the text by screen method are:

Step 1: Now press the Ctrl+a+[ command in the Linux terminal, and then navigate the cursor to the point from where you want to copy the text.

Step 2: Now press Enter to start then use the arrow key to move the end point upto where you want to copy. Then again press Enter, in this way your text is copy. 

Step 1: Now press the Ctrl+a+] command in the Linux terminal, in this way the text wil paste in the terminal.

Conclusion

To copy and paste the Linux terminal command there are different methods used such as, using the keyboard shortcuts, by using the right click option and by using the screen program. Among these methods most easiest one is keyboard shortcuts, in this method, you use the command Ctrl+Shift+C for copy the commands and to paste use theĀ  Ctrl+Shift+V command.