29

Since OS X is a form of UNIX, some UNIX commands can still work on iOS. We try out these commands to control iOS from command line

Take Control of iOS From the Command Line

mobileterminal-works-as-command-line

The most striking quality of iOS is its simplicity. Almost anyone can pick it up and use it without much of any introduction or tutorial. Apple prides itself on making its products easy to operate, and iDevices are the best example of this. When you use an iPhone, you don’t think about the underlying operating system or any of that.

However, a convoluted mess of file systems lie beneath iOS’s placid surface. When you start digging into the guts of an iPad, you find a stripped-down cousin to OS X that shares the same XNU core. OS X is a form of UNIX. This means by transition that some UNIX commands can still work on iOS.

Jailbreak required

Apple will not let you access any of these features straight out of the box. That’s just not part of the game plan. The rest of this guide depends upon your iOS device being jailbroken.

we'd-recommend-jailbreaking-anyway-it's-useful

To jailbreak your phone, check out the Jailbreak FAQ. It lists the correct methods for each and every device and firmware.

Once you’re jailbroken, install MobileTerminal from the BigBoss repo. This will allow you to enter in UNIX commands and handle Cydia stuff from the command line.

Side note: you can also use it for system administration tasks and SSH into other boxes.

Setup and use

Warning: The various tweaks and hacks are often tried and tested by the authors at TechNorms. We also take utmost care to give precise instructions in our articles. Nevertheless, follow these instructions at your own risk. TechNorms or any of the authors contributing to TechNorms cannot be held responsible for any damage to your device.

Setting up MobileTerminal is as easy as downloading it from Cydia and opening the app. Once it’s opened, you can enter in any of these helpful commands:

i-accessed-superuser-as-a-demonstration

su

Accesses root. Lets you make changes to all parts of the file system. Use with caution. The default password is “alpine,” which you should change as soon as possible.

passwd

Changes the password for the given account. Works for normal input and root mode.

exit

Restarts your terminal session (normal mode) or de-elevates from root to normal mode.

sources-being-updated-live

apt-get -h

Displays a help file listing all commands with apt-get, a useful way to download packages.

apt-get update

Refreshes the list of available packages from Cydia.

apt-get upgrade

Installs all available updates from Cydia.

apt-get autoremove

Removes all files used with uninstalled packages.

dpkg-has-a-lot-of-potential-other-commands

dpkg -h

Displays a help file listing all commands with dpkg, a useful way to install separately downloaded .deb files.

dpkg -i <file name>

Installs a .deb file from the given address on iOS.

apt-cache -h

Displays a help file listing all commands with apt-cache, a way to browse Cydia packages from the command line.

apt-cache pkgnames

Shows all available packages in Cydia. Would not recommend using this command, as it takes a very long time to complete.

the-apt-cache-command-in-action

apt-cache pkgnames | grep <term>

Shows all available packages in Cydia with <term> in the name.

apt-cache show ‘apt-cache pkgnames <author>’

Shows all packages by a given developer. Be sure to include the single quotes, or the command won’t work.

gssc

Lists a great deal of information about the device and its hardware/software.

the-gssc-command-doesn't-list-anything-you-don't-already-know

locate <term>

Searches the local file system for <term>.

locate <term> | grep <path>

Searches the local file system for <term> along the directory <path>.

Final thoughts

While MobileTerminal has limited use, it can be faster than going into Cydia. It’s also a familiar way to operate the system for those with a Linux background.  If you’re not sure want to go to all this trouble, check out our guide to 5 Cydia themes worth downloading and 5 you must avoid.