Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6108621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:18:55+00:00 2026-05-23T14:18:55+00:00

Most Unix-like systems have a command that will let you pipe/redirect output to the

  • 0

Most Unix-like systems have a command that will let you pipe/redirect output to the local clipboard/pasteboard, and retrieve from same. On OS X, these commands are

pbcopy, pbpaste 

Is there a way to replicate this functionality while SSHed into another server? That is,

  1. I’m using Computer A.
  2. I open a terminal window
  3. I SSH to Computer B
  4. I run a command on Computer B
  5. The output of Computer B is redirected or automatically copied to Computer A’s clipboard.

And yes, I know I could just (shudder) use my mouse to select the text from the command, but I’ve gotten so used to the workflow of pipping output directly to the clipboard that I want the same for my remote sessions.

Code is useful, but general approaches are appreciated as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:18:55+00:00Added an answer on May 23, 2026 at 2:18 pm

    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. It’s a minor modification to a suggestion from OSXDaily.

    In my case, I use Terminal on my local OS X machine to connect to a Linux server via SSH. Like the OP, I wanted to be able to transfer small bits of text from terminal to my local clipboard, using only the keyboard.

    The essence of the solution:

    commandThatMakesOutput | ssh desktop pbcopy
    

    When run in an SSH session to a remote computer, this command takes the output of commandThatMakesOutput (e.g., ls, pwd) and pipes the output to the clipboard of the local computer (the name or IP of "desktop"). 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.

    It requires your desktop to be configured as an SSH server (which I leave to you and Google). 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.

    Other examples:

    ls  | ssh desktopIpAddress pbcopy
    pwd | ssh desktopIpAddress pbcopy
    

    For convenience, I’ve created a Bash file to shorten the text required after the pipe:

    #!/bin/bash
    ssh desktop pbcopy
    

    In my case, I’m using a specially-named key.

    I saved it with the file name cb (my mnemonic (ClipBoard). Put the script somewhere in your path, make it executable and voilà:

    ls | cb
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have inherited a 20-year-old interactive command-line unix application that is no longer supported
Are there any alternatives to stat (which is found on most Unix systems) which
I'm writing a script that gets the most recently modified file from a unix
I've got an array that uses UNIX timestamps for array keys. The array will
I have a text like that: The C language is%y% widely used today in
I have this sql script that I would like to execute in a java
I have a project that builds with CMake system, and I like to import
I'm trying to use the Unix command paste, which is like a column-appending form
When using mmap() for shared memory (from Linux, or other UNIX-like systems) is it
I read that Linux kernel is preemptive, which is different from most Unix kernels.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.