Mace Mace - 1 year ago 122
Linux Question

Linux SSH with multiple commands

i want to make an ssh-connect to an remote host, there i want to run multiple commands.

ssh -l blabla ls -l

when i run this, i will get the result of
ls -l on 123.123...

Is it possible, to make sth like this:

ssh -l blabla ls -l & ifconfig

... it tried this:

ssh -l blabla ls -l; ifconfig

But there the local bash runs the second command.
I want the second command to run on the remote host.


Answer Source

Just put all commands inside a quotes

ssh afont@ "ls -l; ifconfig;"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download