[Android] install busybox for Android-the complete BASH Shell

Source: Internet
Author: User

Have you ever had this experience? input ADB shell in the command line and then use the command to operate your mobile phone or simulator. However, these commands are common Linux commands, which are not easy to use. Have you ever thought about using a complete shell on Android? Use busybox. You can use terminal emulator either by connecting to the device using the ADB command line or on your mobile phone.

1. What is busybox?

Busybox is a single executable implementation of standard Linux tools. Busybox contains some simple tools, such as CAT and ECHO, and some larger and more complex tools, such as grep, find, mount, and telnet. Some people refer to busybox as the Swiss army knife in the Linux tool. In short, busybox is like a big toolbox, which integrates many Linux tools and commands. (From Baidu encyclopedia)

2. Install busybox on Android

Preparation:

0. First, you need to give the mobile phone to the root user. The specific tutorial is not provided here. There are many online courses.

1. Download busybox's binary, open this address http://www.busybox.net/downloads/binaries, select the latest version, and then download the version corresponding to your device architecture, here I downloaded the busybox-armv6l, the following will take this file name as an example.

2. a command line environment is required. Use ADB on your computer or terminal emulator on your mobile phone.

3. Connect the phone and computer, set the USB mode of the phone to none (only charging), and enable the USB debugging mode.

Installation:

1. Rename busybox-armv6l to busybox

2. Pass busybox to the SD card of your mobile phone. You can use the following command or try another method.

Open terminal (Linux, Mac) or cmd (Windows)

 
ADB push ~ /Desktop/busybox/mnt/sdcard

The~ /DesktopReplace the correct path as needed

3. Enter the following command to write files in the/system directory

 
ADB shellsumount-O remount, RW-T yaffs2/dev/block/mtdblock3/System

Use ls to check whether the/system contains the xbin directory. If not, enter mkdir xbin to create the directory. In this example, install busybox to/system/xbin.

4. Copy the busybox file to/system/xbin and assign it the "executable" permission

 
CP, MNT, sdcard, busybox, system, xbinchmod, 755, busybox

5. Now you can use the busybox command. For example, if there is no clear screen command before, you only need to enter busybox clear to implement the clear screen function. To use the full ls, you only need to enter busybox ls.

However, adding a busybox before each installation is too troublesome, so we need to continue to complete the installation.

Enter

 
Busybox -- install.

If you want to install it to another directory, replace the vertex with another path.

Now the installation is complete. Compare the original LS command with the LS command in busybox.

Common Errors:

1. If such an error occurs during installation,

Busybox:/bin/zcat: no such file or directory

Busybox:/sbin/zcip: Invalid cross-device link

The installation path is not entered. The correct example is as follows:Busybox -- install/system/xbin

2. If such an error occurs,

CP:/system/xbin/busybox: Read-Only File System

The mount command in step 3 is not entered correctly.

TIPS:

1. There are ash, hush, and sh shells in busybox. Enter ash or hush in the command line. You can select the command you just entered by pressing the up/down key as in bash.

2. the Android system itself has ls commands, and busybox also has ls. When LS is input, the android LS is called. Do you need to add a busybox to the front every time you want to use the LS of busybox? No. You can use the alias command.

 
Alias ls = 'busybox ls'

Similarly, commands such as CP and MV can be done in this way. You can also modify/init. RC.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.