I have a Java program Desktop/testfolder/xyz.jar
on a remote machine. It has a configuration file on the same folder. When I SSH into the machine, I do:
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 user@remote.host bash -c "'
cd Desktop/testfolder
java -cp xyz.jar Main
'"
Try something like this:
ssh you@yours.com "cd /home && ls -l"
You could try separating the commands by a semicolon:
ssh user@remote "cd Desktop/testfolder ; java -cp xyz.jar Main"