Secure Shell

Remote commands

Hello World

To send a remote command via SSH (the SSH server needs to be running on the remote host), you can simply write the command after user@machine.

ssh alice@example.com echo 'Hello World'

Hello World

It returns back the output to the sender, executed on the remote host.

Interactive and screen-based commands

Many commands and programs in the remote side are screen-based (e.g. mc) or they need to ask password (e.g. sudo), to be able to run these kind of programs you can use option -t.

ssh -t alice@example.com sudo ls /

[sudo] password for alice:

bin root dev etc home lib mnt opt proc root run usr var


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow