How to control your iPhone from terminal?

Discussion in 'iPhone Tips, Help and Troubleshooting' started by pcs are junk, Jan 31, 2010.

  1. macrumors 65816

    Joined:
    Sep 28, 2009
    #1
    I was just wondering how you can run commands from terminal on a mac, to control your iPhone. You can control it with iRecovery, but that is only for recovery mode, the cool thing is if you type reboot it reboots. So this leads me to thinking there must me codes that you can run to make it do something. Does anybody have any information on this?
     
  2. macrumors 6502a

    Penguissimo

    Joined:
    Nov 17, 2009
    Location:
    Michigan
    #2
    If you have SSH installed on the iPhone, you can use terminal to remotely access the phone. Just type this:

    ssh -l root 192.168.1.100

    Obviously you'll need to replace the IP address with your phone's actual IP address. You'll get a big scary warning about an unrecognized RSA key; just type "yes" and hit enter. Then enter your root password (you changed it from "alpine" when you installed SSH, right?) and you'll have full access to a shell on your iPhone. You won't have all the commands you do on the Mac ("top" is missing, for example), but you can navigate the filesystem, copy, move, and delete files, etc.
     
  3. thread starter macrumors 65816

    Joined:
    Sep 28, 2009
    #3
    yeah i have the password changed, but i mean like can you actually control what it does...like is there a command to open the facebook app or camera? this is what im looking for.
     
  4. macrumors 6502a

    Penguissimo

    Joined:
    Nov 17, 2009
    Location:
    Michigan
    #4
    Oooh, sorry, didn't realize that's what you meant. Apparently with older versions of the firmware, you could launch apps just by typing their path (/Applications/Calculator.app/Calculator, for example), but that doesn't seem to work with 3.1.2.

    If you install the Erica Utilities from Cydia (you may already have them; lots of packages depend on them), it includes the "launch" command, which allegedly lets you launch apps by typing "launch" followed by the application identifier (such as "com.apple.calculator"—you can find this for any app by looking in that app's Info.plist) of whichever app you want to launch.

    I couldn't get this to work, though, and a quick Google shows that it also doesn't seem to work with any 3.* firmware :( If you find a way, please share; it'd be great to be able to do this again!
     

Share This Page