How to use Scrcpy to control Android on Linux
You can connect to your Android device via USB cable or wirelessly and control it with a keyboard and mouse. Here's how to control Android devices on Linux using Scrcpy.
Install Scrcpy in Linux
Before installing Scrcpy, you should install adb (Android Debug Bridge) in your system. For this purpose, execute one of the following commands, depending on your distribution:
# Hệ thống dựa trên Debian sudo apt install adb # Hệ thống dựa trên Fedora sudo yum install adb # Hệ thống dựa trên Arch sudo pacman -S android-tools
After installing adb, install the stable version of Scrcpy:
# Hệ thống dựa trên Debian sudo apt install scrcpy # Hệ thống dựa trên Fedora sudo dnf copr enable zeno/scrcpy && dnf install scrcpy # Hệ thống dựa trên Arch sudo pacman -S scrcpy
It is also possible to install the stable version of Scrcy using snap:
sudo snap install scrcpy
After successful installation, you can verify its version with the scrcpy -v command:
scrcpy -v
Install the latest version of Scrcpy for more features
If you want features like audio forwarding and camera mirroring , you need to install the latest version of Scrcpy (currently version 2.4).
For this purpose, it is necessary to install it through the source code.
First, make sure your system has all the necessary dependencies:
# Hệ thống dựa trên Debian sudo apt install ffmpeg libsdl2-2.0-0 adb wget gcc git pkg-config meson ninja-build libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev
Then, clone the Scrcpy repository using the git clone command:
git clone https://github.com/Genymobile/scrcpy
Next, navigate to its directory and run the Scrcpy installation script:
cd scrcpy ./install_release.sh
This way, the latest Scrcpy version will be installed in your Linux system. To verify it, execute the following command:
scrcpy -v
Now you're ready to connect to your Android device via USB or wirelessly.
Connect to Android via USB cable
To connect to an Android device, you need to enable Developer options and USB debugging .
To do this, go to Settings -> System :
Open the About phone option and click Build number multiple times until you get a message that says ' You are a developer ':
Next, go back to System settings and here you will see Developer options . In Developer options , enable the USB debugging option :
After enabling the USB debugging option, you will receive a prompt to confirm your choice. Here, press the OK button :
Now, connect your phone to the Linux system using a USB cable. After doing this, you will see the USB debugging mode notification on Android.
Next, open Terminal in the Linux system and execute the scrcpy command to mirror the device:
scrcpy
You can see Android mirrored on your system.
To disconnect the phone, just press the Ctrl + C keys .
Connect to Android via wireless connection
You can also connect your Android device wirelessly. First, connect your phone to Linux via USB cable and execute the following adb command to have Linux recognize the Android device:
adb devices
Find your Android device's IP address:
adb shell ip route
Keep in mind : Linux and Android must be connected to the same Wi-Fi network.
You can also check your phone's IP address by going to Settings -> Wireless & network -> Wi-Fi and pressing the Configure button :
Once you know your phone's IP address, you must configure a port for your TCP/IP connection. For example, set it to 5000:
adb tcpip 5000
Note : Any unassigned port can be configured.
Now, disconnect your phone from the USB cable. Then, connect the phone to the Linux system using the phone's IP address and the specified TCP/IP port over the network:
sudo adb connect 192.168.1.121:5000
In case you have multiple devices, you can use your Android's serial number to connect to the device over the network:
scrcpy -S
Finally, execute the scrcpy command to control and project the Android screen:
scrcpy
As mentioned earlier, you can disconnect this connection by pressing the Ctrl + C keys .
You should read it
- How to use the Linux command line on Android with Termux
- 4 Best Android emulator software Linux
- 3 Linux mobile operating systems you can install today
- How to install Linux on Android doesn't need root
- 10 things to keep in mind when switching to Linux mobile operating system
- Linux - Journey from a fun to software that dominates the world
- How to run Android on Linux using a virtual machine
- How to Connect iPhone to Linux PC Using KDE Connect
May be interested
- How to control the entire Android device by voicevoice control of an android device allows you to control your smartphone completely via voice. all you need to do is install an official voice application from google, which is voice access.
- How to turn an Android phone into a universal controller for every home applianceyou want to watch your favorite tv program but can't find the tv controller to turn on? are you sleeping and suddenly feel hot but don't want to wake up to reach for the air conditioner controller on the far table? follow the article below to turn your android phone into a universal controller for every home appliance.
- 7 ways to run Linux software on Windowslinux users want to run windows software on linux, whereas windows users want to use linux software. even if you are looking for a better development environment, more powerful command-line tools, you can run linux software without removing windows.
- How to install Linux on Android doesn't need rootwant to install linux desktop environment on android phone? read the following article to learn how to do it!
- How to Install Kali Linux NetHunter on Androidkali linux is the most popular security and penetration testing operating system in the world. thanks to the nethunter project, you can now install kali linux on your android phone.
- A serious security error appeared on Android that allowed hackers to control smartphones through a photoa serious security hole on the android operating system has just been discovered, which can help hackers run malicious code and control smartphones remotely by displaying a png image file (portable network graphic).
- 10 things to keep in mind when switching to Linux mobile operating systembecause it is an important component of the android operating system (os), linux is still very important to the mobile world. however, while android uses the linux kernel, it is just a linux distribution, but linux for mobile devices offers a completely different experience. find out why using a linux mobile phone is a great option, as well as a downside when switching from your favorite mobile operating system to this operating system.
- Control Linux system with fstabin this article, i will show you how to use fstab to control your linux system.
- Linux - Journey from a fun to software that dominates the worldlinux is everywhere, crept into every corner of our lives. from the phone, computer, to the whole internet. even linux is now finding a way to be present on tvs, heat sensors, and cars.
- Control Android phone remotely with Remote Web Desktopon the market today there is no shortage of software, applications to control android devices remotely. these tools allow users to send or receive messages through the browser, control other peripherals, or become mobile data storage devices.