3

I rooted a HTC Wildfire S device recently and flashed an Android 4.1.2 AOKP Jelly Bean Custom ROM. One benefit is that I can use the terminal now.

I'm a little used to using terminal emulators on desktop machines but never did that on an Android device before. I noticed some commands are not found, for example:

$ tree
/system/bin/sh: tree: not found

Is there a way to add more commands to my device, maybe a bundle of GNU packages for Android available somewhere?

0

4 Answers 4

2

Yes that's possible with the termux terminal.

Homepage | Google Play

You can install additional shell commands using apt.

$ apt update
$ apt upgrade
$ apt install tree

Screenshot:

using termux

Bonus: Also works on non-rooted devices!

1
  • 1
    Termux only works on >= Lollipop devices
    – Caio Lucas
    Commented Jul 26, 2016 at 21:09
1
tree

Isn't even installed on Ubuntu by default.

That said, you can install BusyBox on non CyanogenMod ROMs that lack common utilites. YMMV, but on most "stock" ROMs seem to lack the utilities. AFAIK Busybox doesn't include tree.

ALWAYS DO A BACKUP FIRST!

1

The tree command is not installed by default. I don't know how to install it in Android via the terminal, but you could always use the ls command. Yes, it doesn't show you a tree format that is easy to understand, but it still does the job.

ls -d */

Only list the directories in the current directory.

ls -ltr

List all files by the time they were last modified in reverse order. In other words, the last files listed are the most recently modified files.

Also, install BusyBox to have more Unix commands available. Reference.

0

You can install packages by first installing termux, then you install the desired package, next you type cd /data/data/com.termux/files/usr/bin. Now all you have to do is run these commands

su
cp DESIRED_PACKAGE /bin

Make sure to enter your desired package name at DESIRED_PACKAGE. If you're not sure which packages you want to install simply (while in this directory) type ls

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .