Multiple commands on remote machine using shell script
Try something like this:
ssh [email protected] "cd /home && ls -l"
You could try separating the commands by a semicolon:
ssh user@remote "cd Desktop/testfolder ; java -cp xyz.jar Main"
If you want to split your commands over multiple lines for the sake of readability, you could also pass the list of commands to the bash
command as follows:
ssh [email protected] bash -c "'
cd Desktop/testfolder
java -cp xyz.jar Main
'"