How to Copy and Paste Commands in the Linux Terminal

In this beginner's guide, we will show you how to copy and paste command-lines and text while working on the Linux Terminal. Ctrl C and Ctrl V won't work.

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.

Cancel Command
Cancel Command

CtrlV 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 CtrlV 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 Right-click Menu
Terminal Right-click Menu

Terminal Copy-Paste Keyboard Shortcuts

Keyboard ShortcutWhat it does?
Ctrl+Shift+cCopy selected text
Ctrl+Shift+vPaste copied text
Ctrl+uCut everything from line start to cursor
Ctrl+kCut everything from the cursor to end of the line
Alt+dCut the current word after the cursor
Ctrl+wCut the current word before the cursor
Ctrl+yPaste the previous cut text
Alt+yPaste the second latest cut text
Alt+Ctrl+yPaste the first argument of the previous command

Kiran Kumar
Hi there! I'm Kiran Kumar, founder of FOSSLinux.com. I'm an avid Linux lover and enjoy hands-on with new promising distros. Currently, I'm using Ubuntu as a daily driver and run several other distros such as Fedora, Solus, Manjaro, Debian, and some new ones on my test PC and virtual machines. I have a day job as an Engineer, and this website is one of my favorite past time activities especially during Winter ;). When I'm not writing for FOSSLinux, I'm seen biking and hiking on scenic trails. Hope you enjoy using this website as much as I do writing for it. Feedback from readers is something that inspires me to do more, and spread Linux love!. If you find a time, drop me an email or feedback from the 'Contact' page. Or simply leave a comment below if you found this article useful. Have a good day!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

24,726FansLike
164FollowersFollow

LATEST ARTICLES

Create a ClamAV Antivirus Live USB drive, and how to use it

Antivirus Live CD or USB drives come in handy at times when your computer is infected with a virus and other malware. Here is how you can create a ClamAV Live USB drive to scan and remove the malware from a computer.