Repairing Android smartphones using the command line. Android Terminal Emulator commands for android

Majority Android users don't know anything about A.D.B.. Full title - Android Debug Bridge, stands for Android Debug Bridge. ADB is part Android SDK. At ADB help you can perform various actions on your Android tablet or a smartphone, such as: flashing, copying files from a computer to Android and vice versa, system recovery and others.

ADB for Android - what is it?

You probably know that operating system Android is based on a modified Linux kernel. Therefore, there is a need to use the command line with it. It is the program adb helps establish communication between computer and Android. She is part of the environment Android development SDK, so to install Android Debug Bridge, you need to download Android SDK from the official website. There are versions for all popular operating systems: Windows, Mac OS and Linux. That is, to put it simply, adb allows control your phone or tablet using a computer.

I also recommend the following instructions:

Basic adb commands Android

Connect your device to your PC via USB. Make sure all drivers are installed and USB debugging is enabled.

To Work with Android Debug Bridge best through command Windows string. To do this, in Windows XP, click “Start” and in the “Search programs and files” input field, enter “cmd”, then press “Enter”. If you have Windows 7 or higher, click "Start" and in the "Run" box type "cmd" and press "Enter" again.

adb devices

The most common adb command. Using it, you can determine whether your PC sees the connected device. If you did everything correctly, the following line will appear: “List of devices attached.” After it you will see serial number your smartphone or tablet and its status: “online” or “offline”.

If it says “offline”, this means that the device is in sleep mode, if “online”, then the device is ready to execute your commands.

Thanks to this command you can install applications on your smartphone or tablet. To do this, you need to specify the path where the APK file is located:

adb intsall D:\papka_s_faylom\nazvanie_prilogeniya.apk

To avoid writing long paths, copy the file to the android-tools directory. Then the path will be like this:

adb intsall nazvanie_prilogeniya.apk

adb uninstall

You need to enter it in the same way as the previous command. This will remove the application.

This team has interesting feature. If you add the key -k, then when you delete a game or program, its data and cache will not be deleted, but will remain on the Android device.

Thanks to this command, you can transfer files from your computer to Android. To do this, you need to know the full path where the file is stored and where to move it.

adb push D:\papka_s_faylom\nazvanie_fayla/sdcard/Android

To avoid writing long paths, copy the file to the android-tools directory. Then you need to enter:

adb push nazvanie_fayla/sdcard/Android

This command copies files from Android to computer. You need to know the path where the file is located on your smartphone or tablet and indicate the location where you want to save the file. If you do not specify the latter, the file will be saved in the android-tools directory.

adb pull /sdcard/nazvanie_fayla\D:\papka_gde_sohranity

This command will reboot your Android phone or tablet.

With this command you can directly boot into bootloader mode.

adb reboot recovery

Not all devices support this command. Using it you can get into recovery mode.

adb connect

Using this command you can connect the device to Wi-Fi networks. To do this, you need to know the IP address and port of the device.

adb connect ip:port

With this command you get full access to all files on your device.

Second way to use adb shell is the execution of a single Android shell command using the following construction:

adb shell<команда>

If you put your Android phone or tablet into bootloader mode, then the commands adb will not work anymore. Here you need to use fastboot commands.

To check whether PC and Android can see each other, use the command:

After entering it, the serial number of your device should appear.

By entering this command, you can unlock the bootloader of your phones and Asus tablets and HTC. When your device is in bootloader mode, enter:

Also all yours installed programs and personal data will be lost.

Using this command you can display the contents log file: changes, errors, etc. The data will scroll too quickly, so the right solution would be to save it in one TXT file. To do this, enter:

adb logcat > filename.txt

adb sideload

The command will be useful for owners of devices of the line Google Nexus. Using it you can update the firmware of the device. Download it to your computer, connect your Nexus to it, go to Recovery mode, select “Apply update from ADB” and then enter the command.

Which interesting teams is there for a terminal emulator?

Answers (2)

  1. Terminal emulator is an application for Android through which you can use commands to control the system and make changes to it. This mechanism is based on the fact that the Android system includes the Linux kernel.

    On a computer using command line and utilities configure the system and connect additional modules. Android has inherited many similar features that can be used for various purposes.

    That is, there are binary files that interact directly with the hardware. Each such file corresponds text command, which runs through a terminal emulator.

    Before you start working with the command line, it should be noted that the greatest scope for modifications will be after rooting the Android device.

    In addition, you should install busybox - binary file, which will allow you to use more commands, since the built-in ones are often not enough. To install it you need:

    • download from Play Market BusyBox;
    • open and grant him superuser rights;
    • be sure to wait until the application scans the device;
    • click the “install busybox” button;
    • define the location “/system/xbin”;
    • press "ok".

    After this, you can start installing the terminal on Android and working with it. For this:

    Other commands may take a long time to complete and a white cursor will appear. If an error was made when writing, the message “/system/bin/sh: kv:” will appear. not found" and a prompt for input. This message indicates that the kv command was not found among those available.

    Close the terminal by clicking on the cross in the upper right corner, then a window will appear in which we click “ok”.

  2. There are a lot of commands, to see them all you need to write “busybox” without quotes. In principle, the description of each can be viewed in the terminal itself; to do this, you need to enter the command that you want to learn about and “—help”. Information will appear, but in English. When working with the terminal, you need to take into account some features:

    • the path to files and folders must be written completely after the commands, for example, rm /storage/sdcard0/download/file;
      there should be no errors or extra spaces;
    • The command is launched by pressing the “enter” button, that is, entered and pressed.

    Here are the most popular android terminal commands:

    • cat - reading contents, cp - copying, rm - deleting a file, rmdir - deleting a folder, touch - creating a file, mkdir - creating a folder, - after these commands enter the path to the desired object or place;
    • mv - move, cp - copy, - first write the path to the file or folder, then to the new location;
    • ls - displays the contents;
    • cd - navigates to the desired directory;
    • pwd - shows the full path to the folder being used;
    • date - displays the real date;
    • df - shows the size of objects in the specified folder;
    • du - prints the file size;
      pm install - installs the program from an apk file;
    • pm list packages - shows package files of installed applications;
    • service list - displays a list of running processes;
    • pm uninstall - uninstalls the application, and you must specify the path /data/app/file name, which can be found with the pm list packages command;
    • ln - creates a symbolic link to a file, the syntax is the same as cp.

    You need to be very careful when executing terminal emulator commands, which I will discuss later, since they are used to modify the system and, if used incorrectly, can seriously damage the device:

    • su - provides full access to the system on rooted devices, after entering it the prompt line will look like this “root@android:/ #”;
    • chown and chgrp, the first to change the owner, the second - groups that are specified after the command and then write the file name;
    • chmod - a utility for changing file permissions, the syntax is the same as the previous one - first the rights, then the file;
    • insmod and rmmod use the first to connect modules to the kernel, the second to remove them; these commands are best used only by advanced users;
    • kill - stops a process by its identifier, which can be found using the ps utility - it displays information about all activities;
    • mount, umount are for mounting and unmounting file systems and sections, use only after detailed study systems.

    Special commands that are executed by the emulator Android terminal:

    • reboot - used after the su command to reboot the device;
    • exit - closes the terminal, you can also log out of the administrator through it.

    That is, we used su for utilities that require root rights, and then, so as not to accidentally change something, we enter exit, and the prompt will again become “u0_a106@android:/$”.

    There is another unusual utility called dd - it copies one file or section to another byte by byte. Its syntax is:

    dd if=/dev/block/platform/mmcblk0p1 of=/storage/external_SD/image
    if= device from which we are copying of= file to which we are copying. This command will create an image of the mmcblk0p1 partition.
    It has 2 more parameters - count= fragment that will be used to record new file, bs= volume of fragments in bytes. For example, the command dd if=/storage/sdcard0/file1 of=/storage/external_SD/file2 bs=500 count=7 will copy 7 pieces of 500 bytes from file1 to file2.

Name_device:/$
Where
Name_device:/ this is the name of your smartphone (tablet)

su- the su command gives you Root rights, administrator rights, that is, you can do everything with the device after this command (not before), you also need to get root on your Android device.

Note: Until you run the Su command, you have guest rights.
Name_device:/$
The $ symbol means that you are a guest (i.e. you cannot do anything)
Name_device:/ #
The # symbol means you are Root
Example
Name_device:/$su
Name_device:/ #

pwd– shows the current directory you are in.

ls– the command shows what is in the current directory, namely files and directories.
Example
Name_device:/ # ls
system
data
mnt
bin
and so on...

ls -a– the command shows what is in the current directory, namely files and directories, but with hidden files.
Note: Hidden files, unlike Windows they look like .Name (dot and File Name)

clear- clear the terminal screen.

CD– a command to go to any directory (directory).
Example
Name_device:/ # cd system
Name_device:/system #
Note: Directory or Catalog means Folder
cd..- go to a higher directory

mkdir- the command creates a directory (folder).
Example
Name_device:/sdcard # mkdir android
Note: Folder Name and name are two different folders

rm– deletes the file.

rm -r deletes the directory (Note: if you do not specify the –r option, it will generate an error about the impossibility of deleting the directory).
Example
Name_device:/sdcard # rm -r dom

rm -rf– deletes a file and does not display messages if such a file does not exist or does not have permission to write to it rm -rf – deletes folders without displaying messages.

cp– copies the file.

cp -r copies the directory.

mv– renames the file.
Example
Name_device:/sdcard # mv android ANDROID

touch– creating an empty file.

cat– displays the text in the file.
Example
Name_device:/sdcard # cat skazka

tac- displays the text located in the file in reverse order(1 line last, last line first).
Example
Name_device:/sdcard # tac skazka
Note: if you see a # sign before the line, then the parameter is not processed

ps– displays your currently active processes.

mount– mounts (Connects).

umount- unmounts.

date– displays current date and time.

cal– displays the calendar of the current month.

uptime- shows how long the operating system has been running.

df– show information about disk usage.

free– used memory and swap.

free -m- total volume, used volume and volume free memory in Mb.

du- how much space does your data take up?

halt- quick and correct shutdown of the system

chmod- setting access rights



Name_device:/$
Where
Name_device:/ this is the name of your smartphone (tablet)

su- the su command gives you Root rights, administrator rights, that is, you can do everything with the device after this command (not before), you also need to get root on your Android device.

Note: Until you run the Su command, you have guest rights.
Name_device:/$
The $ symbol means that you are a guest (i.e. you cannot do anything)
Name_device:/ #
The # symbol means you are Root
Example
Name_device:/$su
Name_device:/ #

pwd– shows the current directory you are in.

ls– the command shows what is in the current directory, namely files and directories.
Example
Name_device:/ # ls
system
data
mnt
bin
and so on...

ls -a– the command shows what is in the current directory, namely files and directories, but with hidden files.
Note: Hidden files, unlike Windows, look like .Name (dot and File Name)

clear- clear the terminal screen.

CD– a command to go to any directory (directory).
Example
Name_device:/ # cd system
Name_device:/system #
Note: Directory or Catalog means Folder
cd..- go to a higher directory

mkdir- the command creates a directory (folder).
Example
Name_device:/sdcard # mkdir android
Note: Folder Name and name are two different folders

rm– deletes the file.

rm -r deletes the directory (Note: if you do not specify the –r option, it will generate an error about the impossibility of deleting the directory).
Example
Name_device:/sdcard # rm -r dom

rm -rf– deletes a file and does not display messages if such a file does not exist or does not have permission to write to it rm -rf – deletes folders without displaying messages.

cp– copies the file.

cp -r copies the directory.

mv– renames the file.
Example
Name_device:/sdcard # mv android ANDROID

touch– creating an empty file.

cat– displays the text in the file.
Example
Name_device:/sdcard # cat skazka

tac- displays the text in the file in reverse order (1 line last, last line first).
Example
Name_device:/sdcard # tac skazka
Note: if you see a # sign before the line, then the parameter is not processed

ps– displays your currently active processes.

mount– mounts (Connects).

umount- unmounts.

date– displays the current date and time.

cal– displays the calendar of the current month.

uptime- shows how long the operating system has been running.

df– show information about disk usage.

free– used memory and swap.

free -m- total volume, used volume and amount of free memory in Mb.

du- how much space does your data take up?

halt- quick and correct shutdown of the system

chmod- setting access rights



Almost every user who has at least some knowledge of modern technologies, knows that the mobile operating system Android system built on Linux based. And if we talk about Linux, then you can get full access to the system only through the command line. Android, among other features, also has support for a command prompt, which can also be called a terminal. However, almost all device manufacturers do not install such utilities on their devices, because inexperienced user may make irreversible changes that will affect the performance of your smartphone or tablet.

Option 1 - Installing the application on Android

The easiest way to access the command line is to install special application. Similar programs full in official store Play Store. Just enter the words or in the search. Almost any of the applications found will allow you to use the command line. It’s worth considering that to access system partition you will have to first obtain Root rights.

Option 2 - Using a computer with ADB

You can also use personal computer, however, you have to perform a number of simple steps. Install the appropriate driver for your gadget in advance. After this, you will need to enable USB debugging. The last step will be the installation