Can you access the bash on Android?

Asked

Viewed 1,605 times

6

I’m not an expert on Linux. But if Android uses the Linux kernel, it is understood that there must be some similarities. The terminal would be one of them?

  • Just to strengthen the concept, "Android is a multi-user Linux system". According to this Google documentation: https://developer.android.com/guide/components/fundamentals. Please note the quote: > "The Android Operating system is a multi-user Linux system in which > each app is a Different user."

3 answers

6


An excellent way is adb, but is external to android

to use embedded in own android: Has the 'bash shell x' for android:

https://play.google.com/store/apps/details?id=com.bitcubate.android.bash.installer&hl=pt_BR

when downloading you will use the #root shell button.

But for you to really have access to a larger set of linux tools, you could root your phone, and add busybox

'Busybox is a software application that provides many standard Unix tools as well as the largest (but most capable) GNU Basic Utilities. Busybox is designed to be a small executable for use with the Linux kernel, making it ideal for use with embedded devices. It has been nicknamed "the Linux Swiss Army Knife built in"."' (http://www.androidpit.com.br/forum/644126/para-que-serve-o-busybox)

abs

4

Hello,

yes is possible using the adb see the here more information about him.

In short, adb shell opens the prompt and you can run the commands, but remember that they are restricted.

  • define restricted rs

  • Opa, not all commands are available and not all parameters are allowed, for example the command ls can receive the parameter -t, works in the Linux, does not work in the shell of Android, already the parameter -l works smoothly.

  • Ahh yes. Thank you, man.

2

Complementing the answers already published here in the question, a legal way to use the adb is you setting as an environment variable. So you can use commands adb shell, adb devices, or any other adb make available in the directory where you are.

How to proceed:

  1. Right-click My Computer > Properties > Advanced System Settings > Environment Variables > Click New in System Variables.

  2. Set the variable name to ADB_HOME or other you prefer and the value of the variable that is the path of the Android SDK. In my case the SDK is located in: D:\Android. Hail.

  3. Search for the named system variable Path and click to change it.

  4. At the end of the line, put the previously created environment variable this way: %ADB_HOME%/platform-tools;, separating with semicolon always the statements in this environment variable between different environment variables.

Example of an excerpt from my environment variable Path:

%JBOSS_HOME%\bin;%ANDROID_HOME%\platform-tools;%PHP_HOME%

Do you understand how it works? The adb.exe is located in the folder platform-tools of my briefcase D:\Android, set this root folder as an environment variable called ADB_HOME and in the Path I declared it and put the bar with the name of the folder platform-tools where is the adb.exe.

On Linux, edit your file ~/.bashrc, example:

nano ~/.bashrc
#AndroidDev PATH 
export PATH=${PATH}:/root/android-sdk-linux/tools 
export PATH=${PATH}:/root/android-sdk-linux/platform-tools

Log out, log in again and open Terminal by stating the following command:

adb version

If you correctly return the adb version has been configured correctly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.