12

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?

sawdust
  • 18,591
timn
  • 956

6 Answers6

7

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.

Lee B
  • 1,327
6

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.

Steven
  • 28,386
Natim
  • 1,677
2

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

dvtm can copy/paste with mouse.

slhck
  • 235,242
user203154
  • 21
  • 1
1

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.

0

Try this:

ls $(xsel -o --display :0)

If there is "wa*" in the clipboard it will produce this in any TTY terminal:

$ ls -l  $(xsel -o --display :0)
-rwxr-xr-x 1 root root 1254 Jan 30 11:44 wav_to_mp3.sh
$ 

Maybe it can be made even easier via bash aliases. Anyway I solved that finally this way:

1) copy text into clipboard in TTY7 - GUI 2) then I switch into say TTY1 and I write command: expandclipboard.sh youtube-dl cb 3) the script expands the command and inserts the content of the clipboard at the place of cb and runs is.

the code of the script is:

    #!/bin/bash
    var1=$1
    if [ "$var1" = "cb" ]; then
    var1=$(xsel -o --display :0)
    fi

    var2=$2
    if [ "$var2" = "cb" ]; then
    var2=$(xsel -o --display :0)
    fi

    var3=$3
    if [ "$var3" = "cb" ]; then
    var3=$(xsel -o --display :0)
    fi

    var4=$4
    if [ "$var4" = "cb" ]; then
    var4=$(xsel -o --display :0)
    fi

    var5=$5
    if [ "$var5" = "cb" ]; then
    var5=$(xsel -o --display :0)
    fi

    var6=$6
    if [ "$var6" = "cb" ]; then
    var6=$(xsel -o --display :0)
    fi

    var7=$7
    if [ "$var7" = "cb" ]; then
    var7=$(xsel -o --display :0)
    fi

    var8=$8
    if [ "$var8" = "cb" ]; then
    var8=$(xsel -o --display :0)
    fi

    echo $var1 $var2 $var3 $var4 $var5 $var6 $var7 $var8
    $var1 $var2 $var3 $var4 $var5 $var6 $var7 $var8

I know it is immensely primitive, but I am lazy to pretend that I am any cleverer than this script. :-)

-1

You can connect with other computer by SSH, it's a option =).