Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to put two commands together

I need the script to login:

ssh [email protected]

Then I need to the script to run (while logged in to [email protected] via ssh ):

find /var/mobile/Media/Music/ -name "*.mp3" -exec ln -s {} /var/mobile/Media/Music/"All Songs" \;
share|improve this question

2 Answers 2

up vote 5 down vote accepted

You can include a command to run on the remote machine as the last argument to ssh

ssh [email protected] 'find /var/mobile/Media/Music/ [...]'
share|improve this answer
Worked perfectly!! –  era878 Mar 20 '11 at 20:16

You can try:

sshpass -p YOUR_PASS_HERE ssh [email protected] find /var/mobile/Media/Music/ -name "*.mp3" -exec ln -s {} /var/mobile/Media/Music/"All Songs" \;

Cheers, André Gondim http://andregondim.eti.br

share|improve this answer
Providing password on the command line is not very secure. It's much better to use the public key authentication in such cases. –  Adam Byrtek Mar 21 '11 at 15:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.