Linux: Copy/paste in TTY

26,477

Solution 1

If you don't like screen or gpm, your alternatives are quite limited. The other options I can think of are:

  1. Run terminals under X, maybe using a tiling window manager for a minimalist, console-like look.

  2. Run a *BSD instead of Linux, which will let you use sysmouse instead of gpm. I hear it's better, and my limited BSD experiences suggest that it may very well be better, but I don't know if it's better in the area of clipboard support. Sounds like you mostly just don't like your trackpad though, which is probably unfixable without replacement.

  3. Use pipes, named pipes, scratchfiles, etc. For example, most unix editors will let you process selected text via normal command line scripts, which could be setup to save the selection to ~/.clipboard, for instance. Running commands that input text (cat ~/.clipboard) should be even easier.

  4. Use an editor that supports multiple files, and copying/pasting across them. vim does, and emacs does too, I'm sure.

Solution 2

You can use Ctrl+y to paste. To copy, it depends of what you want to copy. If it is on the prompt : Ctrl+u to cut from the beginning, Ctrl+k to cut until the end.

Solution 3

tmux is similar to screen and gives you the ability to copy-paste.

dvtm can copy/paste with mouse.

Solution 4

depending on what you are trying to copy and paste... bash does have a vi mode which you can edit your commands in a more like vi way than emacs(bash default) (zsh has a vim mode). putting set -o vi in ~/.bashrc enable's it.

Share:
26,477

Related videos on Youtube

timn
Author by

timn

Updated on September 17, 2022

Comments

  • timn
    timn almost 2 years

    I am looking for a way to copy and paste within a TTY. I only have a touchpad, and using it with gpm is a pain. The only possibility I can think of is to use "screen" but even after having remapped Ctrl-A to "`", it is still inconvenient and slow.
    Are there any more-comfortable approaches?

  • timn
    timn over 14 years
    Thanks. These key bindings are really useful. Unfortunately I can only make use of them when I am working on the shell but not in text-browsers or other console tools.
  • timn
    timn over 14 years
    Nice! As I am also VIM user, key bindings similar to the VIM ones come in handy. Actually, one small problem persists: Sometimes there are websites where URLs are not hyperlinked but rather in plain text. If I visit such websites in w3m, I would have to manually copy that link in order to navigate to it. Another example is VIM: If I am viewing a document containing URLs, it is not possible to just "click" them (as in URxvt). Here as well, I have to manually copy them. These are the only two applications, a global clipboard support could be useful. Any ideas?
  • timn
    timn over 14 years
    1) There are a few flaws with the X-Server that prevent me from being effective in it. The first one is that the keyboard strangely reacts much slower than in the framebuffer. This really annoys me as scrolling in a document (VIM) in a URxvt is not by far as fast as a VIM started in a TTY. The next issue is the performance. Although I am using KMS and a tiled window manager (i3), the X-Server does not start up immediately. Neither do the applications. Even small applications such as URxvt take various seconds to start.
  • timn
    timn over 14 years
    What also troubles me is the bloat. X.org is a huge chunk of complex code. As I am not a gamer, nor do I have to maintain many remote desktops, personally I have absolutely no need for direct rendering, X forwarding etc. Actually, the framebuffer offers all I need for working. Only the number of available applications is a bit limited. :) 2) This would not really solve my problem as I want to get rid of my mouse.
  • timn
    timn over 14 years
    3) Yes, that is what I am currently doing whenever I want to visit a link within a plain text document in VIM but honestly, copying the link into the buffer with "yy", then typing ":tabnew url" followed by a "p" for pasting and a final "w3m $((cat url))" on the shell is not as comfortable as an URxvt with "clickable" links.
  • SDsolar
    SDsolar almost 7 years
    Welcome to Superuser. Please take the tour at superuser.com/Tour to get the most out of this site.
  • Scott - Слава Україні
    Scott - Слава Україні almost 7 years
    If, after taking the tour, you still really believe that this is a valid, useful answer, please edit it to explain how it answers the question.  Do not respond in comments; edit your answer to make it clearer and more complete.