How to Execute Linux Commands on Remote System over SSH

4 Responses

  1. NILESHKUMAR CHHALLANI says:

    Awesome share

  2. yazul says:

    3rd example is wrong :
    $ ssh [email protected] uname; hostname; date

    commands “hostname” and “date” excute locally and not thru ssh tunnel !!!
    (local sh split command line on “;” and execute each of them.

    you can test :
    $ ssh [email protected] uname; uname
    $ ssh [email protected] hostame; hostame

    a correct example would be :
    $ ssh [email protected] “uname; hostname; date”

  3. ericm says:

    Hi Pradeep,

    the quote below seems to imply system-info.sh is a local script, which is executed on a remote system (192.168.10.10) However, I have found that this only work if the script is on the remote system. In other words, ssh can execute a script that is on the remote server. Is this also your experience or else can you clarify?

    We just have to provide absolute path of local script to SSH command.
    $ ssh [email protected] ./system-info.sh

Leave a Reply

Your email address will not be published. Required fields are marked *