Skip to content

Instantly share code, notes, and snippets.

@rewida17
Last active April 10, 2024 06:24
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save rewida17/f8564bee5a196a8f51b98cd2e53813e4 to your computer and use it in GitHub Desktop.
Save rewida17/f8564bee5a196a8f51b98cd2e53813e4 to your computer and use it in GitHub Desktop.
Run termux env via eg adb shell
#!/system/xbin/bash
#Based on https://github.com/termux/termux-app/issues/77
export PREFIX='/data/data/com.termux/files/usr'
export HOME='/data/data/com.termux/files/home'
export LD_LIBRARY_PATH='/data/data/com.termux/files/usr/lib'
export PATH="/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:$PATH"
export LANG='en_US.UTF-8'
export SHELL='/data/data/com.termux/files/usr/bin/bash'
export BIN='/data/data/com.termux/files/usr/bin'
export TERM=vt220
export AR="arm-linux-androideabi-ar"
export CPP="arm-linux-androideabi-cpp"
export GCC="arm-linux-androideabi-gcc"
export LD="arm-linux-androideabi-ld"
export NM="arm-linux-androideabi-nm"
export OBJDUMP="arm-linux-androideabi-objdump"
export RANLIB="arm-linux-androideabi-ranlib"
export READELF="arm-linux-androideabi-readelf"
export STRIP="arm-linux-androideabi-strip"
export TERMUX="/data/data/com.termux/"
resize
cd "$HOME"
exec "$SHELL" -l
@arifab
Copy link

arifab commented Mar 20, 2019

how to use this code

@AnirudhJohn
Copy link

Copy the code and save it to a file, then push it to the android device and run it as a script, don't try to give it the execute permissions with "chmod +x", because that doesn't seems to work insted run it with "sh script"

@AnirudhJohn
Copy link

and also change the TERM variable's value to screen

Copy link

ghost commented Nov 23, 2022

Thanks alot for this example, it works perfect.

It's best so far so I added it to my wiki, here: https://github.com/wuseman/adb-cheatsheet/blob/main/README.md#enter-termux-enviroment-from-adb

// wuseman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment