Q. How do I copy and paste text or output from a shell prompt? How do I copy text from one terminal window and paste it on diffrent server window using mouse?
A. You can easily copy and paste between multiple shell prompts or the terminals using nothing but your mouse only. This is useful to transfer configuration lines from one terminal to another all opened over ssh session.
Most Linux distros are configured the click of a middle mouse button as paste operation. All you have to do is select text, move your most to another window and hit the middle mouse button. If you have a scroll wheel, just press on it to past the text. If you see only two buttons, just hit both button simultaneously i.e. you can emulate a third, "middle" button by pressing both mouse buttons simultaneously.
Optional: Linux Mouse configuration
Usually you can reconfigure mouse by editing /etc/X11/xorg.conf file or your distributions mouse configuration tool. You can also use xmodmap utility for modifying keymaps and mouse pointer button mappings in X. Here is my sample PS2 wheel Mouse entry:
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "ZAxisMapping" "4 5"
EndSectioFurther readings:
- man pages xorg, xmodmap, xsetpointer etc
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop





![Linux Find Out If the PCIe / AGP / VGA Driver Is Installed OR NOT [ Radeon X1550 64 bit ]](http://s13.cyberciti.org/images/shared/rp/3/21.jpg)





{ 11 comments… read them below or add one }
With keyboard:
Copy: Ctrl+Shift+C
Paste: Ctrl+Shift+V
Only works in gnome, not in kde or another gui.
…the real answer I’ve always wanted is how to cat the contents of a file to the clipboard. For example:
cat myfile | x-clipboard
That would occasionally save me a lot of selecting and copying.
@Aaron
Apparently, this is a rather challenging thing to do. I’m there with you though – I will love to pipe into the clipboard. I’ve looked for a way to do it, but have never found such a way. Someday…
Mike–I found the answer a few days after I read the article.
Do this:
uptime | xclip
In your favorite X application (like gedit) middle-click. It should toss your uptime into gedit.
Unfortunately (at least with Ubuntu) there appears to be different clipboards. The X clipboard pastes when you middle-click, but there is another clipboard for when you actually click copy/cut/paste from a menu or use the Control+C/V/X
Hmmm…I can’t get this to work cause I don’t have middle click emulation on. I could play with that, but I like it off anyway. I’m in waiting until the right solution comes along.
This is a good start though, thanks.
Mike–I have some additional info for you.
I tried:
echo Hello | xclip -i -selection clipboard
From all my applications, I could hit CTRL+V or middle-click to paste, but the “Paste” menu showed up in grey for all those applications. Strange.
Doing some digging turns up that X has multiple clipboards called Primary, Secondary, and Clipboard.
More info in it here: http://standards.freedesktop.org/clipboards-spec/clipboards-latest.txt
Hey, that seems to work. Incredible. Time to make an alias to that combo.
I saw that bit about multiple clipboards, but it’s so baffling that I didn’t want to figure it out.
Why in the &*(% is it done this way? Eek.
Hi,
i could not able to copy/paste by clicking right and left mouse button in my terminal, what need to be configured? this will save lots of time
now i am right clicking and selecting the copy and paste option to do this. pls help
regards,
Murugesh
Yes this is working fine.
Hello Everyone.
I need to know how can I copy from Linux and paste into a world document.