A better shell for Android devices
C Shell Python Java Other
Switch branches/tags
Clone or download
Latest commit b931596 Jun 2, 2017
Permalink
Failed to load latest commit information.
stub-arm-pic Make bash(1) dependency explicit Oct 18, 2015
stub-arm Make bash(1) dependency explicit Oct 18, 2015
stub-local Make bash(1) dependency explicit Oct 18, 2015
stub-x86-pic Make bash(1) dependency explicit Oct 18, 2015
stub-x86 Make bash(1) dependency explicit Oct 18, 2015
.gitignore Make build deterministic Sep 3, 2015
Agent.java Fix Agent on S7, possibly others Dec 1, 2016
AgentFakeContext.java Fix Agent on S7, possibly others Dec 1, 2016
LICENSE New licence headers Aug 12, 2014
Makefile.am Add ping command Mar 15, 2017
Makefile.am.fb-adb Add ping command Mar 15, 2017
Makefile.am.stub Add ping command Mar 15, 2017
Makefile.binary-releases Enable git stamps in release builds May 22, 2015
NEWS Correctly respect SIG_IGN and blocked signals from process start Nov 12, 2015
PATENTS Use new PATENTS version May 22, 2015
README.lz4 Add LZ4 to build May 9, 2015
README.md Add instructions for building on mac. Dec 31, 2015
adb.c Compat hacks Feb 3, 2016
adb.h Compat hacks Feb 3, 2016
adbenc.c Tune transfer for higher-latency links; fix adbenc bug Mar 15, 2017
adbenc.h Tune transfer for higher-latency links; fix adbenc bug Mar 15, 2017
agent.h Rename finfo; add jdwp proxy; add pidof command May 14, 2016
androidmsg.c daemon improvements Sep 12, 2015
androidmsg.h daemon improvements Sep 12, 2015
ar-lib Work May 13, 2014
argv.c daemon improvements Sep 12, 2015
argv.h daemon improvements Sep 12, 2015
arpy.py Make build deterministic Sep 3, 2015
autogen.sh Fix copyright headers again Aug 12, 2014
channel.c Tune transfer for higher-latency links; fix adbenc bug Mar 15, 2017
channel.h Tune transfer for higher-latency links; fix adbenc bug Mar 15, 2017
chat.c Always get a PTY even with newer adb Oct 17, 2016
chat.h Replace chat_swallow_prompt with new flag on chat_talk_at (Internal API) Apr 24, 2016
child.c Rename finfo; add jdwp proxy; add pidof command May 14, 2016
child.h Rename finfo; add jdwp proxy; add pidof command May 14, 2016
cmd.c Push signal restoration down into xexecvpe; fix help Nov 23, 2015
cmd.h add service for working around fb-adb bugs Sep 11, 2015
cmd_bash_completion.c make bash completion work when fb-adb is not in PATH Sep 21, 2015
cmd_echo.c Add ping command Mar 15, 2017
cmd_fcat.c split fs.c off from util.c Sep 8, 2015
cmd_fget.c split fs.c off from util.c Sep 8, 2015
cmd_finfo.c Rename finfo; add jdwp proxy; add pidof command May 14, 2016
cmd_fput.c xcmd command Sep 11, 2015
cmd_getprop.c Look up __system_property_find_nth dynamically Mar 9, 2017
cmd_help.c Push signal restoration down into xexecvpe; fix help Nov 23, 2015
cmd_jdwp.c Rename finfo; add jdwp proxy; add pidof command May 14, 2016
cmd_logcat_json.c Improve signal-handling robustness Sep 16, 2015
cmd_logwrite.c Rename logw to logwrite; keep logw as a compatibility alias Oct 30, 2015
cmd_pidof.c Rename finfo; add jdwp proxy; add pidof command May 14, 2016
cmd_ping.c Add ping command Mar 15, 2017
cmd_ps_json.c Push signal restoration down into xexecvpe; fix help Nov 23, 2015
cmd_rdex.c Rename finfo; add jdwp proxy; add pidof command May 14, 2016
cmd_readlink.c Improve signal-handling robustness Sep 16, 2015
cmd_shex.c Skip clowny output lines in another context Apr 17, 2017
cmd_shex_usage.txt Update rcmd/shell usage May 22, 2015
cmd_start_daemon.c Set prgname to stub while in daemon Sep 13, 2015
cmd_stop_daemon.c daemon improvements Sep 12, 2015
cmd_stub.c Tune transfer for higher-latency links; fix adbenc bug Mar 15, 2017
cmd_stub_package_hack.c daemon improvements Sep 12, 2015
cmd_tar.c Fix deprecated warnings with major() on glibc 2.25 Jun 2, 2017
cmd_xdex.c Rename finfo; add jdwp proxy; add pidof command May 14, 2016
cmdsproc.py ctar command Sep 21, 2015
commands.xml Add ping command Mar 15, 2017
compile initial checkin May 6, 2014
config.guess Work May 13, 2014
config.sub Work May 13, 2014
configure.ac Fix deprecated warnings with major() on glibc 2.25 Jun 2, 2017
constants.h Check that our AF_UNIX peer has expected UID when using the service-s… Sep 16, 2015
core.c Tune transfer for higher-latency links; fix adbenc bug Mar 15, 2017
core.h Improve signal-handling robustness Sep 16, 2015
dbg.c Tune transfer for higher-latency links; fix adbenc bug Mar 15, 2017
dbg.h add service for working around fb-adb bugs Sep 11, 2015
depcomp initial checkin May 6, 2014
dex.c Rename finfo; add jdwp proxy; add pidof command May 14, 2016
dex.h Rename finfo; add jdwp proxy; add pidof command May 14, 2016
elfid.c xcmd command Sep 11, 2015
elfid.h xcmd command Sep 11, 2015
errcodes.h Rename finfo; add jdwp proxy; add pidof command May 14, 2016
fb-adb.bashsrc.in Unbreak bash completion May 31, 2016
fb-adb.c Stop forwarding to adb Sep 18, 2015
fdrecorder.c Fix pipe2() conditionals on other Unices Oct 17, 2015
fdrecorder.h Use fdrecorder instead of letting adb inherit stderr Sep 14, 2015
fixhtmldoc.sed Add HTML documentation generation Sep 20, 2015
fs.c Fix -Werror=overflow Jun 2, 2017
fs.h Add ping command Mar 15, 2017
htmldoc.css.in Responsive layout for HTML doc Sep 21, 2015
install-sh initial checkin May 6, 2014
json.c Add new logcat-json command Sep 8, 2015
json.h Add new logcat-json command Sep 8, 2015
lz4.c Add LZ4 to build May 9, 2015
lz4.h Add LZ4 to build May 9, 2015
missing initial checkin May 6, 2014
mk-fingerprint.py Update the permissions so the python scripts are executable May 24, 2016
mkagentc.py Update the permissions so the python scripts are executable May 24, 2016
mkstubsc.sh Make bash(1) dependency explicit Oct 18, 2015
net.c Rename finfo; add jdwp proxy; add pidof command May 14, 2016
net.h Rename finfo; add jdwp proxy; add pidof command May 14, 2016
peer.c Rename finfo; add jdwp proxy; add pidof command May 14, 2016
peer.h Rename finfo; add jdwp proxy; add pidof command May 14, 2016
proto.h Tune transfer for higher-latency links; fix adbenc bug Mar 15, 2017
ringbuf.c Tune transfer for higher-latency links; fix adbenc bug Mar 15, 2017
ringbuf.h Fix copyright headers again Aug 12, 2014
sha2.c Fix OS X build Sep 18, 2015
sha2.h add finfo feature Aug 28, 2015
strutil.c Move rename-via-adb-directly facility to adb.c May 1, 2015
strutil.h Move rename-via-adb-directly facility to adb.c May 1, 2015
stub-config.sh Make bash(1) dependency explicit Oct 18, 2015
stubdaemon.c Move daemon sigchld reaper closer to main loop Feb 16, 2016
stubdaemon.h daemon improvements Sep 12, 2015
stubs.h Use xxd instead of assembly to incorporate raw files Dec 22, 2014
termbits.c Fix copyright headers again Aug 12, 2014
termbits.h Fix copyright headers again Aug 12, 2014
termnames.h.in Fix copyright headers again Aug 12, 2014
termnames.sed Fix copyright headers again Aug 12, 2014
timestamp.c.in Make build deterministic Sep 3, 2015
timestamp.h Make build deterministic Sep 3, 2015
tree.h Rename finfo; add jdwp proxy; add pidof command May 14, 2016
utf8.c Add new logcat-json command Sep 8, 2015
utf8.h Add new logcat-json command Sep 8, 2015
util.c Always get a PTY even with newer adb Oct 17, 2016
util.h Always get a PTY even with newer adb Oct 17, 2016
valgrind.h Add new logcat-json command Sep 8, 2015
xenviron.c Push signal restoration down into xexecvpe; fix help Nov 23, 2015
xenviron.h Support sending environment variables May 22, 2015
xfer.c Rename finfo; add jdwp proxy; add pidof command May 14, 2016
xfer.h Add fget, fput commands Sep 7, 2015
xmkraw.c Restructure TTY setup and management Aug 28, 2015
xmkraw.h Restructure TTY setup and management Aug 28, 2015

README.md

fb-adb is a tool for interacting with Android systems. It does much of what adb does, but with better remote shell support and, hopefully, fewer bugs. Differences between adb and fb-adb are that fb-adb:

  • is binary clean (no LF -> CRLF mangling)
  • transmits and updates window size
  • distinguishes standard output and standard error
  • properly muxes streams with independent flow control
  • allows for ssh-like pty allocation control
  • propagates program exit status instead of always exiting with status 0
  • properly escapes program arguments
  • kills remote program
  • provides a generic facility to elevate to root without re-escaping

DOWNLOADS

You can use Homebrew to install fb-adb binaries:

brew install fb-adb

BUILDING

An out-of-tree build is required. You'll need a copy of the Android NDK: tell configure about it by setting the ANDROID_NDK environment variable to your NDK path or by using the --with-android-ndk argument to the configure script.

For example:

./autogen.sh
export ANDROID_NDK=/path/to/android-ndk
mkdir build
cd build
../configure
make

If building on Mac, you need gmake to build. You can use Homebrew to get it:

brew tap homebrew/dupes
brew install homebrew/dupes/make

and then use gmake instead of make.

RUNNING

The fb-adb executable itself has no dependencies other than the adb executable, which must be on PATH. Generally, you can use fb-adb just like adb; fb-adb forwards unknown commands to adb. fb-adb supports the same device-selection options that adb does.

fb-adb shell is the fancy shell command that supports the features described above. Run fb-adb shell -h for additional options.

EXAMPLES

  • Capture a screenshot from device and write it locally to a timestamped file:

    fb-adb rcmd screencap -p > screenshot-$(timestamp).png

  • Dump database.db of the com.bar.foo app:

    fb-adb rcmd -u com.bar.foo sqlite3 /data/data/com.bar.foo/databases/database.db .d

  • Open remote shell as the user com.bar.foo:

    fb-adb shell -u com.bar.foo