BlackHat
BlackHat

Reputation: 147

Copy Paste Command in Text Based Linux Server (No GUI)

As mentioned in the title, how can I copy and paste text to Linux command line in a text based Linux server?

Normal Ctrl + Shift + V doesn't work.

Upvotes: 5

Views: 19380

Answers (5)

Adriano Lima
Adriano Lima

Reputation: 71

I had the same need and managed to solve it using the screen package:

apt-get install screen

When you run screen, it will open a 'virtual shell' where you can run commands and copy/paste the content:

  • Ctrl + A then Esc to enable navigation mode
  • Space to start selecting the text. Press it again to finish the selection
  • Ctrl + A then ] to paste the selection

Upvotes: 0

hek2mgl
hek2mgl

Reputation: 157947

Note: This question is about a terminal, not a terminal emulator. A terminal is what you see when you connect a computer without a graphical desktop to a monitor and keyboard (no mouse supported at that point)

On a text based terminal (not a terminal emulator(!)) copy/paste is not possible.

If possible, I recommend to use ssh and connect with a terminal emulator which does support copy/paste to that box. For example gnome-terminal could be used for that: https://help.gnome.org/users/gnome-terminal/stable/txt-copy-paste.html

Upvotes: 7

Carlo Wood
Carlo Wood

Reputation: 6791

apt install gpm

Then use your mouse.

Upvotes: 0

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

Retro computers have different sets of combination like.

ctrl + insert for copying or yanking.

shift + insert for pasting.

Upvotes: 0

Trevor Hickey
Trevor Hickey

Reputation: 37806

I think you're looking for xclip.

For example, this is how you copy/paste to and from your clipboard:

xclip file.txt -selection clipboard; #copy
xclip -selection clipboard -o;       #paste

Although normally avialble on OSX, I noticed that my Ubuntu build also has pbcopy / pbpaste.
It should come to no surprise though, that they are just aliases:

$ which pbcopy
pbcopy: aliased to xclip -selection clipboard
$ which pbpaste
pbpaste: aliased to xclip -selection clipboard -o

Upvotes: 3

Related Questions