Skip to content

Instantly share code, notes, and snippets.

@rewida17
Last active April 10, 2024 06:24
Show Gist options
  • 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
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