Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Mirror Android Screen on Linux: Step-by-Step

· 4 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

This guide shows you how to mirror your Android phone's screen on a Linux desktop, letting you view and control apps, show photos, or record a demo. You'll need a USB cable (or a Wi-Fi connection), a recent Android device, and a Linux system with the required tools installed. The main method uses scrcpy, an open-source tool that streams your screen with low latency and supports keyboard/mouse input.

What You'll Need

  • A Linux computer (any mainstream distribution; Ubuntu, Fedora, Arch, etc.)
  • An Android phone with USB debugging enabled (Developer Options)
  • A USB cable for the initial setup (wireless works after the first wired connection)
  • Internet access to install packages
  • Optional: ADB (Android Debug Bridge) tools, often installed as a dependency

Step-by-Step

  1. Enable Developer Options on your phone: Go to Settings > About phone and tap Build number seven times. You'll see a message that you're now a developer.
  2. Turn on USB debugging: In Settings > Developer options, toggle on USB debugging. If you plan to use wireless mirroring later, also enable Wireless debugging (Android 11+).
  3. Install scrcpy on Linux: Use your package manager. For Debian/Ubuntu: sudo apt install scrcpy. For Fedora: sudo dnf install scrcpy. For Arch: sudo pacman -S scrcpy. If it's not in your repos, build from source (see the official GitHub page).
  4. Connect your phone via USB: Plug the phone into your computer. On the phone, a dialog will appear asking to allow USB debugging – check Always allow from this computer and tap OK.
  5. Verify the connection: Open a terminal and run adb devices. You should see your device listed as device (not unauthorized or offline). If it's unauthorized, unplug and replug, then accept the prompt again.
  6. Start mirroring: In the terminal, run scrcpy. Your phone screen will appear in a window on your Linux desktop. You can now use your mouse and keyboard to interact with it.
  7. Optional: Mirror wirelessly (Android 11+): After the first wired setup, unplug the cable. On your phone, note the IP and port from Wireless debugging. Then run adb pair IP:PORT and enter the pairing code shown. Finally, run adb connect IP:PORT and then scrcpy.
  8. Adjust settings as needed: Use command-line options. For example, scrcpy --max-size 1024 reduces resolution, scrcpy --full-screen goes fullscreen, and scrcpy --record file.mp4 records the screen.

Common Mistakes

  • USB debugging not enabled: Without it, ADB can't see your device. Double-check Developer Options.
  • Driver issues on Linux: Most Linux systems work out of the box, but if ADB says no permissions, you may need to add a udev rule. Search for your phone's vendor ID and create a rule in /etc/udev/rules.d/.
  • Using the wrong USB port: Some USB ports (especially on laptops) don't support data transfer. Try a different port.
  • Phone screen locked: If the phone is locked, scrcpy may show a black screen. Unlock it first.
  • Forgetting to accept the RSA key prompt: When you first connect, your phone asks to allow the computer. If you miss it, ADB will show unauthorized.

Tips

  • Use a high-quality USB cable – cheap cables often cause disconnects.
  • For better performance, lower the resolution with --max-size or limit the frame rate with --max-fps.
  • If you only need to view (not control), use --no-input to prevent accidental clicks.
  • To copy text from your phone to your computer, use scrcpy --clipboard-autosync.
  • You can run scrcpy over Wi-Fi without a cable after the initial setup – it's convenient for quick demos.

Troubleshooting

  • ADB says "device unauthorized": Unplug the USB, replug, and on your phone tap Allow when the dialog appears. Check the box to always allow.
  • ADB says "no devices found": Ensure USB debugging is on, try a different cable or port, and run sudo adb kill-server then sudo adb start-server to restart ADB with proper permissions.
  • scrcpy opens but screen is black: Unlock your phone. If it still fails, try scrcpy --turn-screen-off (this turns off the phone's display but keeps the mirror).
  • Lag or low frame rate: Lower the resolution with --max-size 800 or reduce bitrate with --bit-rate 2M. Close other heavy apps on your computer.
  • Wireless connection drops: Ensure both devices are on the same network, and disable VPN or firewall that might block the connection. Re-pair if needed.
  • scrcpy not found after install: Log out and back in, or run hash -r to refresh your shell's command cache.

Frequently Asked Questions

Does this work with any Android phone?

Yes, as long as the phone runs Android 5.0 (Lollipop) or later. Older versions may not support screen mirroring via ADB.

Can I control my phone with the keyboard?

Yes, scrcpy maps your keyboard to the Android input. For example, the home button is usually the Home key, and back is Backspace or Escape depending on settings.

Is it possible to mirror without USB debugging?

No, USB debugging is required for ADB to communicate with the device. It's a security feature that must be enabled.

Can I record the screen while mirroring?

Yes, use scrcpy --record filename.mp4. The recording is saved on your Linux machine, not on the phone.

Will this work over Wi-Fi without a cable?

Yes, after the initial USB setup, you can use adb connect to mirror wirelessly. Android 11+ has a dedicated wireless debugging option that simplifies this.

Is scrcpy safe to use?

Yes, it's a well-known open-source tool. It only mirrors your screen and doesn't modify your phone. However, be cautious when granting ADB permissions to untrusted computers.