Those of you who read through the first part of the Common Basic Android Terminal Commands Every Android Owner Should Know post are aware that we covered five basic terminal commands device owners should know. Just to recap these were the: adb devices command, the adb push command, the adb pull command, the adb reboot command and the adb reboot – bootloader and reboot recovery command. This article discusses the remaining five terminal commands namely: the fastboot devices command, the fastboot OEM unlock command, the adb shell command, the adb install command and finally the adb logcat command.
6. The Fastboot Devices Command
The Android Debug Bridge (adb) no longer works when users are working on the bootloader. As such Android users that find themselves not booted in to their devices with the debugging tools not active to communicate with have no alternative but to use the fastboot command in place of adb. Fastboot is generally the most power tool available for the Android device however it can be typically observed that most Android devices do not come with this function enabled.
If your device happens to be fastboot enabled it is important to ensure that there is communication between the two. This is where the fastboot devices terminal command comes in to play. All an android device users need to do is key in “fastboot devices” at the prompt so as to receive a serial number much like in the Android Debug Bridge (adb) devices command we coved in part one of this article. If it seems like things are not working and you happen to be a Windows users then the most probably reason for this is that you may have a driver issue. Under such a circumstance heading online to look for a solution in the numerous forums dedicated to offering this type of assistance is the best place to start when trying to sort things out.
Posts you might like
7. The Fastboot OEM Unlock Command
The OEM (Original Equipment Manufacturer) unlock command which is considered by most users the holy grail of Android commands and helps users do one thing and one thing alone – which is unlock Nexus devices (or a HTC device using the official HTC RUU tool). For those of you out there using devices from different manufacturers this Android terminal command will not apply to you. Such individuals have to source for a different tool or method of unlocking things e.g. through the use of ODIN (a computer software program used by Samsung in installing different firmware on devices via USB), .sbf (system binary files) or RUU (ROM Update Utility).
This article includes the Fastboot OEM Unlock Command as one of the basic terminal command that every Android owner should know because even though you as an individual users may not need it, this terminal command constitutes an important part of Android openness. Google is not concerned with what phone and tablet buyers do with the devices they have bought and as such include a simple way to crack them open. This is something we don’t usually see from many tech companies and such constitutes the main reason why most people choose Android.
Using the Fastboot OEM Unlock Command is fairly simple. Once you have ensured that your device and computer are communicating with the fastboot devices command discussed above you have to do is key in “fastboot oem Unlock” at the prompt and press enter. This action will present you with options so make sure you read through them carefully and select wisely.
Tip: Using the “fastboot oem unlock” will erase everything on your device.
8. The Android Debug Bridge (adb) Shell Command
This command usually confuses a lot of Android device users because there are basically two ways to use the Android debug bridge (adb) shell command, these are:
- where the user actually enters the device command shell from their terminal and
- where the user sends a command to the device to run its own command line shell
This image above illustrates a scenario where a user is inside the device shell listing the folders and files on their device. Getting to the point illustrated above is fairly simple. All one needs to do is key in “adb shell” and hit enter. Once in, a user can escalate themselves to the root if they need to. It is important to point out and further stress that adb shell command users need to exercise extreme caution here particularly in the case of those individuals who are not familiar ash or bash shells since thing can quickly turn bad if not careful. For those of you who are not familiar, ash and bash are command shells a lot like those used by Mac and Linux computer users. They are nothing like DOS.
The second way to use the adb shell command is in conjunction with one the ash commands that Android devices can run. This method of employing the adb shell command is typically used for more advanced tasks such as running tasks, changing permission on files and folders etc. Using the command is easy – “adb shel <command>”. An illustration of this would be altering the permission on a file as such: “adb shellchmod 666/data/filename”. As mentioned above it is important to remember to be extremely careful when using these commands.
9. The Android Debug Bridge (adb) Install Command
While the adb push command enables users to copy file to their Android devices, the Android debug bridge (adb) install command actually installs APK (Android PacKage i.e. .apk) files. Using the adb install command is very similar to using the adb push command since users need to provide the path to the files they wish to install. What this means is that it is always simpler to drop the application you want to install in to your tools folder than taking the longer approach that requires you to keying in the path. Once this is done, the next step involves you telling your device to sideload (this means installing apps without using the official Android Market) as such “adb install AppName.apk”.
To update an application you should use the -r switch i.e. “adb install –r AppName.apk”. There is also the -s switch which allows users to try install apps on their SD card if their ROM supports it and the –i switch which enables users to forward lock the application (i.e. install to/data/app-private). There are a number of other advanced encryption switches however those are left for discussion in another article.
To conclude with the adb uninstall command allows users to uninstall applications by their package name as such “adb uninstall AppName.apk”. This terminal command has a switch of its own too which is the –k switch. Using the –k switch however only helps users to uninstall the application but retain all the cache and application data in place.
10. The Android Debug Bridge (adb) Logcat Command
To some Android device users the adb Logcat command is one of the most useful terminal commands out there. However this command just prints a heap of gibberish unless one fully comprehends what they are looking at. This command enable users to return the events written to different logs in the functioning of Android systems and as such offers invaluable data for system debuggers and application developers. Most Android device users will only run this command when requested by an application developer nevertheless it is still important for device owners to know how to appropriately use it.
In order for a device owner to view their log out put on a computer screen they simply need to key in “adb logcat” and press enter. Though things may scroll down quite fast and as such affecting the chances of users finding what they are looking for there are a number of ways in which this can be dealt with, these are through the use of filters or text output. Filter switches are used when application developers have placed tags in their apps and wish to view what event logs are indicating about it. If needed most developers generally tell users what tags to append to commands. The text output approach on the other hand comes in handier since it allows users to log to a .txt file on their computers to allow for easy reading or access later. This command can be used as such: “adb logcat>filename.txt”. Users can let this command run while they do whatever it takes to crash the system program or application they are debugging, once done the command can be closed by hitting the CTRL + C Keys. The full log file can be found saved in the directory a user is working from e.g. the tools folder. This is what should be sent to the developer.
It is important to remember that sensitive data may be contained in the log files and as such it is vital to ensure that you trust the individual you are sending them to. Alternatively users can simply open log files in text editors so as to view what information is included and edit it accordingly.
There are numerous other switches for the logcat command that savvy developers can choose between. Some of the switches include: radio logs or main event, rotate log files on user device or computers and verbosity logs that allow users to change the verbosity of log entries and so much more. Some of these methods are slightly advanced and require users to read through the Android developer documentation before use.