I'd like to print some string to all open terminals processes that are running in remote machine. currently I'm using ssh to connect the remote machine, and than I echo my string into wall command :

local> ssh me@
(prompt to provide credentials)
remote> echo "123" | wall 

is there a way to do it all in one command that will run without user interactions ?

1 Answer 1


You will need to setup SSH key based authentication so that you do not need to enter a password.

  1. On the client machine, run the following to copy your current user's publickey to the server's authorized_hosts file:

    ssh-copy-id me@
    <enter password>
  2. Make sure that you do not need to enter a password now:

    ssh me@ true
  3. Then simply append the command to the SSH command as following:

    ssh me@ 'echo asdf | wall'

You probably need to use the -tt flag with SSH, to ensure that you run the command in a TTY.

Note the single quotes ', they ensure that the pipe | does not get parsed by your local shell.

  • 9
    As an alternative to the single-quoted pipe approach, if you have working passwordless login, you could instead use something like echo asdf | ssh me@ wall. The difference is that in this form, the echo runs on the local system. Either way works in most cases, but running the command producing the message locally may allow for better error handling in some cases. Nov 28, 2022 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.