Sometime you need to run a command or two command or many command on one ssh connection and then exit immediately. To run one command you just need to add the command behind the ssh command, like this :
$ ssh user@remote_computer command
example :
$ ssh john@192.168.1.100 ls -l
that command will execute "ls -l" on remote computer (192.168.1.100) and display the result on your computer.
But, you may have a question how to run multiple command on ssh. To do that you need to add double quotes at the beginning and the end of your command. Separate every your command with semicolon. Like this :
$ ssh user@remote_computer "command1; command2; command3;"
example :
$ ssh john@192.168.1.100 "ls; ls /etc;"
With that command you can execute many command with one ssh connection.
0 comments:
Post a Comment