psh
is a lightweight C++ utility designed to provide a controlled root-like shell environment on Termux for Android. It wraps around existing su
binaries to launch commands or shells with privilege escalation, while managing environment variables, user switching, and system paths carefully.
psh
acts as a smart front-end for su
(superuser) commands in Termux. It provides:
su
.psh [options] [user]
-p, --syspre
Prepend Android system paths (/system/bin
, etc.) to the PATH.
-a, --sysadd
Append Android system paths to the PATH.
-s, --shell <shell>
Specify an alternate shell executable to use instead of the default.
--version
Show psh
version.
-h, --help
Show usage help.
Run root shell with default environment:
psh
Switch to a different user:
psh someuser
Run a command as root preserving environment:
psh -E ls /root
Specify shell explicitly:
psh -s /system/bin/sh
Run with the --dbg
option to enable debug logging to a file psh_debug_<YYYYMMDD>
in the current directory:
psh --dbg ...
Debug logs include environment variables, architecture, Android version, device info, kernel, and command execution details.
You can install psh
easily on Termux using the provided install script, which downloads the appropriate binary for your device architecture, sets permissions, and configures ownership:
Run this command directly in Termux (curl or wget):
curl -fsSL https://psh.dergoogler.com/install.sh | bash
Or with wget:
wget -qO- https://psh.dergoogler.com/install.sh | bash
By default, it installs the latest stable release. You can specify a version like so:
VERSION=1.0.0 curl -fsSL https://psh.dergoogler.com/install.sh | bash
Note: The installer aborts if run as root inside Termux, ensuring safe installation.