![]() ![]() There are various tools to access X11 selections, including xclip and XSel. But I'll add the details later if I see any interest Server (inside SSH session) cat some_useful_content.txt | nc localhost 2000Īctually even if you're in the middle of an ssh session there's a way to start a tunnel but i don’t want to scare people away from what really isn’t as bad as it looks. Note: if you don't have pbcopy then just tee it to a file. ![]() (hint: make this a keybinding so you don't have to type it) Client (another tab) nc -l 2000 | pbcopy Client (ssh session startup) ssh -R 2000:localhost:2000 I've started using this and it's nowhere near as intimidating as it looks so give it a try. Here's another way to do it, though you'll need to modify how you ssh into your computer. the client and server to be in the same network (which is not the case if you're at work trying to access your home computer).X11 on the client (if you have it, xclip on the server works great) or.Put the script somewhere in your path, make it executable and voila: ls | cb I saved it with the file name cb (my mnemonic (ClipBoard). In my case, i'm using a specially named key Other examples: ls | ssh desktopIpAddress pbcopyįor convenience, I've created a bash file to shorten the text required after the pipe: #!/bin/bash It's much easier if you've set up ssh keys to facilitate fast ssh usage, preferably using a per-session passphrase, or whatever your security needs require. ![]() It requires your desktop to be configured as an ssh server (which I leave to you and google). In other words, it uses nested ssh: you're connected to the remote computer via one ssh session, you execute the command there, and the remote computer connects to your desktop via a different ssh session and puts the text to your clipboard. ls, pwd) and pipes the output to the clipboard of the local computer (the name or IP of "desktop"). When run in an ssh session to a remote computer, this command takes the output of commandThatMakesOutput (e.g. The essence of the solution: commandThatMakesOutput | ssh desktop pbcopy Like the OP, I wanted to be able to transfer small bits of text from terminal to my local clipboard, using only the keyboard. In my case, I use Terminal on my local OSX machine to connect to a linux server via SSH. It's a minor modification to a suggestion from OSX Daily. I'm resurrecting this thread because I've been looking for the same kind of solution, and I've found one that works for me. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |