Mace Mace - 5 months ago 18
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 123.123.123.123 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 123.123.123.123 ls -l & ifconfig


... it tried this:

ssh -l blabla 123.123.123.123 ls -l; ifconfig


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

Thanks!

Answer

Just put all commands inside a quotes

ssh afont@123.123.123.123 "ls -l; ifconfig;"
Comments