Every time you go across Terminal Tuts on our website, you should be reading usage of lengthy command lines that are to be entered into the Terminal. Obviously, we don’t expect you to type the entire command manually, but rather use copy and paste.
In this beginner’s guide, we will show you how to copy and paste command-lines and text while working on the Terminal.
A bit about Ctrl + C and Ctrl + V Keyboard Shortcuts
We all are used to Ctrl + C and Ctrl + V keyboard shortcuts when copying and pasting text within documents, file & folders copy-paste, so on and so forth. While this shortcuts still work on most of the Linux environment including File Manager, Text Editor, and LibreOffice suites, it won’t work in the Terminal.
There is good reasoning behind this behavior in the Terminal. Ctrl + C is used as an interrupt key in the Bash shell, meaning it cancels the active command or program. For example, I cancelled the password request prompt in the below screen-shot which otherwise would be proceeding until I enter the correct root password.
Ctrl + V is used to insert the following character. For example, Ctrl + V + R will insert R into the editor.
Ctrl + C to copy and Ctrl + V to paste was introduced in Mac OS in 1983, and in Microsoft Windows 3.x in 1990 for the clipboard session. Unix has been in use much before that. Hence, when the modern Terminal was made, they couldn’t use Ctrl + V for paste function.
In short, the Ctrl key is used in combination with a character to perform special functions in Bash. Hence, modern Terminals need to do something else.
Okay, so how to paste text in the Linux Terminal?
Due to the above-discussed issue, the modern Terminal developers applied Ctrl + Shift + V for paste. Similarly Ctrl + Shift + C for copy function. Alternatively, you can right-click and select paste from the menu for pasting the copied command-line.
Terminal Copy-Paste Keyboard Shortcuts
|Keyboard Shortcut||What it does?|
|Ctrl+Shift+c||Copy selected text|
|Ctrl+Shift+v||Paste copied text|
|Ctrl+u||Cut everything from line start to cursor|
|Ctrl+k||Cut everything from the cursor to end of the line|
|Alt+d||Cut the current word after the cursor|
|Ctrl+w||Cut the current word before the cursor|
|Ctrl+y||Paste the previous cut text|
|Alt+y||Paste the second latest cut text|
|Alt+Ctrl+y||Paste the first argument of the previous command|