, ,

Common Basic Android Terminal Commands Every Android Phone Owner Should Know (Part 1 of 2)

For most if not all Android and tablet users, the fact that they can plug in their tablets and Android phones to their computers and interact with them is a huge plus. Apart from instances where such device owners have broken something and need to fix it, there are a number of grounds why advanced Android users would want to communicate with their devices. In order for this to be possible for users, there are a number of tools and few commands that each user needs to equip him or herself with so as to be able to perform such functions.  Granted this article will not be the end all be all account of adb (Android Debug Bridge) commands, however there are at the very least 10 elementary commands every Android users should equip themselves with if they want to get down and dirty with command lines.

Android terminal command tools are fairly simple to get acquainted with. For Linux and Mac users, all you need to do is install the Android Software Development Kit (SDK) as indicated in the Android Developers website. It is quite simple and Android users do not have to worry about issues such as Driver complications that arise like Windows users have to.  For those of you who are Windows users however it is both simultaneously a little easier and harder to get things set up.  The tools themselves make up the easy part where all one has to do is download the following file http://cdn.androidcentral.com/sites/androidcentral.com/files/uploads/tools/android-tools.zip. Once you have done this you need to open the zip file and click on the Android tools folder. You may choose to drag this folder to somewhere easy for you to access for convenience or leave it where it is, this step is basically up to you. Next step involves you visiting your devices manufacturing page so as to access the “adb “(Android Debug Bridge) and “fastboot” installation drivers for Windows.

The Android Debug Bridge (adb) and Fastboot drivers allow android users to communicate with their device via a computer. If you run in to complications when trying to install the necessary tools simply visit a forum as they are a great place to get help from others who have tried and succeeded.  Now that we have covered the basics on how to access and install the Android Software Development Kit for both Android and Windows device owners the next step required in enabling you to communicate with your device is enabling USB debugging on your device. If you need help finding it going through your device manual should be able to offer assistance. Once done plug your device in to your computer using the USB cord after which you’ll be all set to getting familiar with following ten Android commands lines:

 

1.      The Android Debug Bridge Devices Command

The Android Debug Bridge Command

The Android Debug Bridge (adb) devices command can be put down as one of the most important command lines of the lot since it is the command line that is used in ensuring that your Android device and computer are communicating. It is for this reason that the adb device command appears first on the list.

For those of you who are pros at tinkering with the operating systems on your PC (Personal Computer) then you would probably want to add the directory with Android tools to your path. For those of you who are rookies in this area then no need to worry, all you have to do is start up the command console or terminal and point it to the folder that has the tools in it. This will be the platform tools folder from the fully installed Android Software Development Kit (SDK) or the file downloaded earlier from http://cdn.androidcentral.com/sites/androidcentral.com/files/uploads/tools/android-tools.zip for Windows users.  Windows users are luck here in the sense that they have a simple short cut that can be accessed by hitting Shift on the keyboard and right clicking on the folder so as to open a console in the right place. Linux and Mac Users have to install an extension for their file manager in order to perform the same “default short cut” function as discussed above for Windows or navigate there once the terminal is open.

Once you establish that you are in the right folder the next thing you need to do is key “adb devices” (minus the “” marks) in the command prompt. Doing so will result in you receiving a serial number. If you do not however get a serial number then you need to counter check if you are in the right folder and that you have USB debugging switched on. If you are using windows you need to check if the device driver installed correctly. Once you have this done you can then progress to mastering other commands.

 

2.      The Android Debug Bridge Push Command

The Android Debug Bridge Push (adb) Command can typically be described as a terminal command used by device owners who wish to programmatically move a file on to their Android device. In order to perform such a function Android device owners need to be familiar with a number of parameters mainly the full path of the file they wish to push and the full path of the place the wish to place it.

Let’s have a look at a small illustration in order to get a better understand of this terminal command. Assume you have a song (sunshine) from a music album and wish to place it in your devices Music Folder. You will need to copy the song’s mp3 file on to the Android tools folder so as to avoid having to key in a long path to your desktop, then head back to the command line and key in “adb push sunshine.mp3/sdcard/Music/” and the file will copy to your device right in the Music Folder. If you chose to not place the file in your tools folder then you would have been forced to key in the full path i.e. C:\Users\James\Desktop\sunshine.mp3. Both approaches to moving files work but it is simpler to just drop the file in your tools folder and save yourself the typing.

Android Debug Bridge Push Command users also need to indicate the full path on their devices where they wish to place their files. The popular Google Play Android explorer application is useful when it comes to find this. It is important for Windows users to remember that when on Android they should be careful to use forward slashes (i.e. –/) when switch folders since it is Linux.

 

3.      The Android Debug Bridge Pull Command

Though simple deductive reasoning it is easy for anyone to deduce that if adb push command works by means of sending files to an Android device then the adb pull command does the opposite i.e. gets messages out of such a device. This Android Debug Pull Command functions in more or less the same manner in which the adb push command does. Users need to know the path of they wish to pull off as well as the path the wish to place the pulled file. You may choose to leave the destination path blank which means that file will be automatically dropped in to the tools folder making things simpler for you.  Doing this the hard way will require you to key in both the path you wish to pull the file off e.g. “/sdcard/Music/sunshinemp3” and the file you wish to place it on/ the destination e.g. “C:\Users\James\Desktop”. Once more the simpler approach would be to simple drop the file in the tools folder by failing to provide a destination i.e. “adb pull/sdcard/Music/sunshinemp3”. Don’t forget to use forward slashes if you are an Android device user.

 

4.      The Android Debug Bridge Reboot Command

For those of you who are not sure, the Android Debug Bridge Reboot Command is exactly what you think it is i.e. a means to reboot a device from the command line. Running this terminal command line is simple in the sense that all one needs to do is key in “adb reboot” and hit enter. Now before I know some of us out there are thinking “hey, why can’t I just push the button!” Well the main thing you need to realize is that such commands can be scripted and as such devices if required can reboot in the middle of a script – a great transition to terminal command number five.

 

5.      The Android Debug Bridge Reboot – Bootloader and Reboot Recovery Commands

So, not only is it possible for you to reboot your device through terminal commands, it is also possible for users to specify that their devices reboot to the bootloader. This function comes in handy particularly for those people who have a wide range of devices that they can never seem to remember and for those that button combinations that are touchy.  A few devices on the market such as the LG Optimus Black do not have an alternative means in which to boot to the bootloader without the application of this command. Using this command is fairly simple, all you need to do is key in “adb reboot-bootloader” and then hit enter.  Once more being able to use this terminal command in a script is priceless.

Though most devices on the market today can also boot directly to the recovery with the “adbreboot recovery” (it is important to note that there is not “–“hyphen in this) some cannot. It does not hurt to try this command line out.

Continue to part 2

 

Sources:

github

XDA Forums

Android Central

Stack Overflow