LinuxBasics.org

The community that helps people to run Linux

rss
Table of Contents

Copy and Paste

While most applications support the mechanism for cut, copy & paste that most people are used to from other operating-systems, X11 also has another mechanism which is faster once you get used to it. It even works between two linux/unix-computers across the network

Picking the menus

As you know from other operating-systems, you can pick the items “cut”, “copy”, and “paste” from the “edit” menu. Works as expected.

Keyboard shortcuts

Standard

As you know from other operating-systems, you can cut, copy and paste by pressing the control-key together with “x”, “c”, “v”. The X is nice to remember for to cut. The C is for copy, and the V looks like the insertion mark we used in school when we forgot a letter in the middle of a word. Works as expected

New and fun maybe

There are also some keyboard shortcuts you can use that are a little different. These belong to some of the Linux editors you might use without a mouse. That’s enough to go on another page Copy and Paste with no mouse in console editor

X11-Goodie: Mouse only!

In X11, selecting a text with the mouse is enough to put it into the X11-clipboard. You can insert it by pressing the middle mouse button. If your mouse has a wheel, this is the button you need to press. If your mouse has only two buttons, X11 is usually configured to use a simultaneous click on both of them instead.

This can be really fast. For example, I have configured my browser to start without a page loaded, the URL-field is already empty. So I can use this fast method to copy URLs into the browser.

From one box to another

So, you have more than one computer connected. You can use the technique described above to copy text from one Linux-PC to another.

You connect to the other box using
ssh -X user@computer
where user is the username you need to log in, and computer is the ip-address of the computer you want to log into.

After giving your password, any command you type in that shell runs on the other computer but displays output and windows on your screen. And then you can copy to and from. Works like expected :)

Can you give me an example, please?

Sure, glad you asked.

I have a workstaion called “vivid” configured so that two nfs-exports from the server (called “files”) are mounted. Also, a removable drive can be used. All this information is inside /etc/fstab. For my laptop, I want to have the same lines, so I can have the same environment. I do this by a simple copy and paste operation across the network:

  1. I log into the the other computer using ssh. For the screenshot I used
    ssh -X root@192.168.1.191
    but as I realize now, I could have done it as user.
  2. I display the text I am interested in. While I could have done so using “cat” or “less”, I chose “emacs”. Emacs displays the hostname in the window-title, so you can see where you are.
    emacs /etc/fstab
  3. I selected the lines I want to reuse by moving the mouse over them while pressing the left mouse-button. It gets highlighted.
  4. In another shell, I start emacs locally. I chose some example-filename, but in real life, I would have taken /etc/fstab directly.
  5. Inside the local emacs-window, I push the middle mouse-button. The text gets inserted.
  6. After finishing my remote-work, I can log out by typing “exit”, “logout”, or simply by pressing ctrl-D

Do you have a screenshot of that example?

I sure do. Here you are: copy-n-paste-screenshot
But watch out: It is 1400×1050. I love big screens :)

Only when using X11?

No. There is a piece of software called ‘gpm’ which enables the technique described above also for the plain linux text-console. It even works across different virtual terminals which can be switched using <alt>+<f1> … <alt>+<f6>. Again, you can log into different computers on different virtual consoles to copy & paste across the network.

We also have compiled a list of ways to copy and paste in different text-mode-editors on this page.

How can I learn more about the wonderful world of networking?

On LinuxBasics.org: Networking and remote access


Copyright (c) by the authors.
Prior to editing, authors agreed to license their contributions by the terms of the GPL.
See our licensing page for details.


Linux® is a registered trademark of Linus Torvalds.


 
  tutorials/using/copy_and_paste.txt · Last modified: 2008/07/20 19:08

LinuxBasics.org

Start Linux-Course Tutorials Linux Links Security Blog Forum E-mail List Search Online Chat

Site-Info

Help Get in Touch Making of LBo

Wiki-Control

Powered by

Linux Apache DokuWiki Mailman RUTE ht://Dig