Ever found yourself on the run, needing a multiple-monitor setup but only have your *nix machine and an Android device handy? Following is a few commands to run applications on the Android device.

Additionally, this method uses the Android development tool adb with the option to use a USB cable instead of WiFi for a little extra speed.


The steps are as follows:

  1. Install an X server on your Android device. I’m using XSDL.
  2. Run and customise the server e.g. choose the desired resolution etc.
  3. Install adb on your *nix machine, like:
# Arch-based distros
yay -S android-platform-tools
# Debian-based distros
sudo apt-get install android-tools-adb
# Fedora/SUSE-based distros
sudo yum install android-tools
# Macos/OSX-based
brew cask install android-platform-tools
  1. Connect your Android device to your machine via USB.
  2. Enable USB debugging on the device under “Developer Settings” within the Android “Settings”. If you don’t have the “Developer Settings” menu item you need to enable¹ it.
  3. Then, in on your favourite CLI forward from your local TCP port 6100 to the remote 6000.
adb forward tcp:6100 tcp:6000
  1. Next, set up the environment variable to point to the new monitor like so:
export DISPLAY=:100
  1. Install x2x via your package manager if it is present, or from Github.
# Arch-based distros
yay -S x2x
  1. Run x2x in the background with the following:
x2x -east -to :100 -from :0 &
  1. Install the xfwm4 package thusly:
# Arch-based distros
yay -S xfwm4
# Debian-based distros
sudo apt-get install xfwm4
# Fedora/SUSE-based distros
sudo yum install xfwm4 # presumably?
  1. And lastly run xfwm4 and the application you need in a separate terminal editor or via a launcher, script etc. DO REMEMBER though to set the DISPLAY variable before running said applications.
# With xfwm4
DISPLAY=:100 && xfwm4 & terminator

# Without xfwm4, such as would be the case on Mac
DISPLAY=:100 && terminator


  • If you end up using this a lot or find the steps tedious, run the following script:
#!/usr/bin/env bash

export DISPLAY=:100
adb forward tcp:6100 tcp:6000
x2x -east -to :100 -from :0
  • and use dmenu or similar launcher to to prefix the environment variable to and executable.

May the force be with you.


  1. Tap on the “Build number” label seven times (or until you’re notified that “Developer Settings” has been enabled)