TQ
dev.com

Blog about software development

Subscribe

Script to type clipboard content in a remote console

28 Aug 2025 - by 'Maurits van der Schee'

As an IT professional, I often work on remote consoles, especially during installations or troubleshooting. Once SSH is set up, copying and pasting is easy. However, to gain access initially, I need to enter my public key on the remote machine. Sometimes this has to be done through a VNC console, or even a Java or Spice console window. While modern ed25519 public keys are only about 50 characters (much shorter than old RSA keys) it's still tedious to type them in by hand.

This small but annoying problem made me want a better solution. I usually play around with bash scripts and xdotool commands, but I always forget the exact syntax, and it's not very user-friendly. I appreciate how modern terminals show an edit window for multi-line pastes, allowing you to verify or modify the contents. I wanted a "type the clipboard" application that uses this concept. I also dislike the typical 2 to 5 second delay in most tools, which is meant to give you time to select the correct window, but if you're not fast enough, your clipboard content might be typed somewhere unintended.

I also wanted an icon to click for activating clipboard typing, a shortcut that can be added to a panel, and an application entry in the main menu. It should be easy to bind the script to a shortcut, and also available from the terminal, since that's where I spend most of my time. These requirements led me to write my own script in bash that uses xclip, xdotool and yad.

I wrote a single-file bash script that fulfills all my needs. This Linux script works only on X11 (not Wayland), which is fine for me since I prefer to use Linux Mint XFCE. A Wayland version could be made in the future, but that's a separate project. The script is open source (MIT licensed) and available on my GitHub:

https://github.com/mevdschee/type-clipboard.sh

I hope you like it as much as I do. Enjoy!

NB: If you have ideas for improvements, please open an issue in the tracker.

Links


PS: Liked this article? Please share it on Facebook, Twitter or LinkedIn.