Skip to main content

Command Palette

Search for a command to run...

"PASTE" from linux desktop to terminal window

Updated
3 min read

Background

I have been working a bunch in Proxmox lately, specifically with OpenWRT. I managed to get it installed as a VM, but having trouble with getting to it from the client VM (Linux Mint). I need to do some commands in the Proxmox terminal view, as I can not get to it from the "network".

audio

I am a copy/paste person. You can not paste a command in the terminal. Works on the server (host) terminal, but not for the VMs. After a long, hard 2 days of searching, I found at least a way to "paste" from my machine to the terminal. I want to put this out to others so that maybe someone else will find a quick solution in their web search.

audio

"paste" sort of

audio

The hack will take the contents of your clipboard and issue keystrokes where the cursor is. Not exactly paste, but close enough. Still will not copy in the terminal and allow me to paste locally (iPv6 addresses are a pain!), but it is a start and a fix to half my problem. I have made the transition for my daily driver to be Linux Mint, so this is from a Linux OS/laptop (Framework rocks!).

After many hours searching, I found an answer in an old Proxmox forum posting:

https://forum.proxmox.com/threads/novnc-copy-paste-not-works.19773/post-101013

audio

💡
NOTE: xdotoolworks only for an X11 windows system. If you are using Wayland, you might also reference https://askubuntu.com/questions/212154/create-a-custom-shortcut-that-types-clipboard-contents and the ydotool [ Debian ] [ GitHub ]. ydotool will require a background daemon to run for it to work as noted in the GitHub README.

audio

THE STEPS


Install xdotool [ Debian ] [ GitHub ] and xclip [ Debian ] [ GitHub ] on your workstation.

audio

sudo apt install xdotool xclip


Open up the Keyboard settings and click on shortcuts tab.

audio


Create a new custom shortcut named whatever you like, "SendKeys" in my case.
Add the following command:

audio

sh -c 'sleep 1.0; xdotool type "$(xclip -o -selection clipboard)"'


Assign the keys you wish to use. I use ALT-V.

audio


Conclusion

This is somewhat of a hack. But it works, and is fairly non-intrusive.

audio



Resources used: