Get To Know Linux: Copy and Paste
It may sound like we've stepped back to Computers 101, but copy and pasting in Linux can sometimes be a bit different than it is in either Windows or Mac. The good news is that it is most often far easier to copy and paste in Linux than it is in any other operating system. How can such a basic function be any easier? Read on to find out.
The typical action of cutting and pasting does and should (in most cases) work across applications as well as into the command line. The trick is knowing either the key combinations or the correct mouse buttons. So whether your copying and pasting from one document to another, from document to email (or vice versa), or just about any application to any application Linux can copy and paste. Let's find out just how.
This is the big one that makes your copy/paste life very simple. With the Linux operating system there are three mouse buttons: 1, 2, 3. The left mouse button is button 1, the right mouse button is button 2, and the mouse wheel is button 3. If your mouse doesn't have a mouse wheel then pressing both 1 and 2 together is the equivalent of button 3. Now that we have that out of the way I am going to show you a nice trick. Go to a document (OpenOffice, Abiword, or even compose an email). Highlight some text by clicking button 1 and dragging the mouse over the text you want to highlight (simple text selection). Once you have selected your text click your cursor in a blank area of the document and click button 3. What you should see is the selected text is pasted where you clicked with button 3. So the action of highlighting text with button 1 is copying and clicking with button 3 is pasting. How simple is that? This action also works from document to command line and vice versa.
Naturally the standard keyboard key combinations will work for copying and pasting. There are a couple of exceptions. When copying within (or to and from) some terminal windows there are different key combinations to use. For example, in gnome-terminal instead of Ctrl-c and Ctrl-v (for copy and paste) you use Ctrl-shift-c and Ctrl-shift-v for copying and pasting. This can be changed within the profile editor in gnome-terminal (if you want this feature to echo the standard combination.) Be aware, however, that if you copy text by selecting via the left mouse you can not paste by using Ctrl-v. The Ctrl-v combination (or Ctrl-Shift-v combination) only works in conjunction with the Ctrl-c or Ctrl-Shift-c combinations.
As you can imagine nearly every Linux GUI application has an Edit menu that includes the Copy/Paste entries. These work exactly as you would expect. These menu entries also work in conjunction with the Ctrl-c/v combinations, but not the button 1 highlight action (button 1 copy action only works with the button 3 paste action).
I will warn you that once you get used to the button1/3 copy/paste action you will find yourself attempting it in all other operating systems. This method of copy/paste is the easiest means of copying and pasting content bar none. It is nice, however, that the various Linux distributions include other means for those users who prefer the standard methods.Advertisement
> Be aware, however, that if you copy text by selecting via the
> left mouse you can not paste by using Ctrl-v.
In KDE the user can copy with the mouse and paste with the keyboard shortcuts. That is probably a Gnome bug. Did you search to see if there is a bug report open?
What is KDE: I don’t believe it’s a bug. and the mouse-to-keyboard doesn’t work (at least in my installations) for either GNOME 2.24 or KDE 4.2. nor does it work in E17, E16, AfterStep, Windomaker, or Fluxbox.
So how do you replace a selection of text with another selection of text?
Oh I see, Linux can’t do that.
Sigh: Yes, actually it can. In fact, it can do this exactly as Windows can. c and v are your friends.
thnks man gd work..
Thank you that’s interesting but I have the following problem:
When I want to replace a text (eg: address in browser) usually I do the following:
1select a text,
2 press Ctrl+C
3 select text to be replaced
4 press Ctrl-V
If I do that with MOUSE, when I select the text to be replaced it goes into the clipboard making uneffective the next pasting
How could I avoid that?
“Once you have selected your text click your cursor in a blank area of the document and click button 3. What you should see is the selected text is pasted ___where you clicked with button 3___.”
This may seem trivial, but I have a problem with this. How can I paste the selected text on the destination window where the previous cursor was, instead of where the mouse actually points?
Reason: With the current way, I must be very careful to point to the place where the text will appear. If it worked as I describe, I would only have to click anywhere in the receiving window, and know that the text will always appear in the place where the cursor is.
Thank you for the clear explanation. If only I had read this a year ago! Pedro’s comment is also enlightening.
You can also copy and paste in Linux using ctrl+insert to copy, and shift+insert to paste. If you find your edition of Linux doesn’t support the Windows ctrl+x/c/v convention, try those instead.
ctrl/shift+Insert also works separately from the highlight/click method, so if you want to highlight and replace text, you can use that method too.
I remember my college days (~1996-2000) when we had to use Solaris. Boy, did I hate that OS. It also made me hate Linux. I remember thinking to myself, why, in the name of God, are there 6 or 7 different ways to copy and/or paste, depending on the application? It cemented this feeling I had that Linux will never grow, as it’s not just “not user-friendly”, it’s actually user-hostile. I don’t want 6 or 7 ways of doing this most simple of tasks, and I don’t care if there are decent reasons behind why there are 6 or 7 ways. I don’t have the time or patience to learn all this arcane crap. I already have a head full of other stuff that I need to remember. I want an OS that will help me get my work (or play) done, not one that I have to fight, or one that compels me to learn its little foibles.
Look at this (this is what you get if Google ‘linux copy paste’), it’s plainly ridiculous:
Paste the text which is currently highlighted somewhere else. This is the normal “copy-paste” operation in Linux. (It doesn’t work with Netscape and WordPerfect which use the MS Windows-style “copy-paste”. It does work in the text terminal if you enabled “gpm” service using “setup”.) Best used with a Linux-ready 3-button mouse (Logitech or similar) or else set “3-mouse button emulation”).
In a command line environment:
Cut last word with keyboard only
Press multiple times to cut more than one word
Paste with keyboard only
In a non-command line desktop environment:
Command line desktop exchange:
Copy text out of the command line and into the desktop:
Shift+Ctrl+c or Apple+c
Paste text from the desktop into the command line:
Shift+Ctrl+v or Apple+v
On any Linux desktop!
Copy with mouse only
Simply select the text with the mouse
Paste with mouse only
Click the middle mouse button or both left/right buttons simultaneously
I don’t know if the newer versions are better, I guess they must be, but then which one of 74,000 different ones should I use?
Apple is just as bad, except from the other end of the spectrum. Windows, somewhere in the middle, is nowadays, the least annoying. And I’m not looking to start a war, it’s just my experience.