Scrcpy is the best tool to cast your android device to Linux and control it as well. You do not even need to install any additional app on your phone.
It is just a very simple tool that you can use to easily control your android device. You can install Scrcpy via command line with just a command and start to use it immediately.
So follow along this tutorial to install scrcpy to cast your android device on linux.
What makes Scrcpy different from other tools are its awesome features that it offers.
- Scrcpy is very light weight and easy to use
- Can connect multiple android devices at once
- Works over both USB and WiFi connection
- You can capture the screen of the android device
- Works over SSH
- You can control the frame rate at which the screen is shared
- Full compatibility with android
- And many more
In this article I am going to do a basic setup of Scrcpy, which is installing Scrcpy on Linux and casting our device on Linux via USB and WiFi.
Scrcpy is available as both APT and Snap package and can be installed with their respective commands.
Install Scrcpy on Linux
Let us now install Scrcpy on Linux so that we can cast our android device on Linux easily.
First open a new Terminal windows and execute the following command.
sudo apt install scrcpy
If you want to install scrcpy as a snap package then use this command. If you have used the above command then you already have scrcpy and does not need to use this method.
sudo snap install scrcpy
Once you have installed scrcpy use the following command to check if it is successfully installed.
scrcpy --version
Once its installed we can jump straight into sharing the screen of our android device on Linux. More detailed installations instructions can be found on Scrcpy github page.
Casting screen over USB.
You can easily cast the screen of your android device over USB but for this feature to work you should have USB debugging enabled on your android device.
Connect your android device to your PC via USB and follow the following steps.
You will see a confirmation on your android device after connecting to your PC for USB debugging, click on trust this device and remember my choice.
Step 1. Open a Terminal window
Open a new terminal Window once you have connected your android device via USB.
Step 2. Launch Scrcpy
Check if you got a “Trust this device” confirmation on your android device and proceed to launch Scrcpy.
- How to install Unity game engine in Linux?
- Is Linux easy to learn?
- How to use tor as a proxy in Linux mint 20 and Ubuntu 20.04 LTS
As I mentioned before, no additional software is needed to be installed on your android device. Execute the following command in the terminal.
scrcpy
As soon as you start scrcpy, a new window casting your android device will pop-up. You can also use your mouse and keyboard to control your android device right from Linux.
The clarity of your shared android screen and input speed will depend on how good your USB cable is. You can buy some really great speed USB cables on Amazon.
Casting screen over WiFi
You can also use the same software without any other configuration to cast your android screen over WiFi.
For you to cast the screen over wifi, both your Linux and Android devices should be connected to the same wifi network.
Before we can cast over wifi we need to configure the device via USB first. So follow the starting steps of USB method and connect your device to USB.
Once done follow the following steps.
Step 1. Install ADB tools
ADB tools come installed with many Linux distribution. Execute the below command to check if you have ADB installed.
If you see a similar output as shown in in the image, this means ADB is installed.
adb --version
If you does not get similar output, execute the below commands to install ADB tools on your system.
sudo apt-get install android-tools-adb
Or if it doesn’t work,
sudo apt-get install adb
Step 2. Get the IP address of your Android device
We now need to know the local IP address of our device , this is not the Ip address that you will see on Google while searching “what is my IP”. Instead this IP is assigned by your Wifi router.
Your local address will look something like 192.168.x.xxx. You can find your local IP address on your router’s admin panel or execute the following command in Terminal to get the IP address of your android device connected via USB.
adb shell ip route | awk '{print $9}'
Step 3. Enable adb over TCP/IP on your device
Scrcpy will use ADB to cast your android screen on Linux. Execute the command below in your terminal to start sharing screen.
adb tcpip 5555
Step 4. Unplug your device
We are now ready to cast our android screen without USB over WiFi. SO unplug your android device from your PC and follow the next step.
Step 5. Connect to your device
Now we are ready to connect to our android device. Execute the following command in terminal.
adb connect DEVICE_IP:5555
Replace DEVICE_IP with the IP address that we got in Step 2. So that for me it will become adb connect 192.168.1.101
We are now connected to our android device and now follow the next step to cast your android device on Linux.
Step 6. Launch Scrcpy
You can now run Scrcpy as usual and a windows with your device screen will op up.
scrcpy
We are now connected to our device via WiFi. DO not worry about those warning we can ignore them for now. You can see a new windows now with your android screen on it.
If you see your android screen glitching or the screen cast is slow this means that your USB router is slow and needs an upgrade.
You can buy high speed USB WiFi routers from Amazon here.
Another way to resolve this issue is to decrease the resolutions and limit bit-rate.
Instead of running the usual scrcpy command use the following command to launch a resolution limited scrcpy instance.
scrcpy --bit-rate 2M --max-size 800
This will decrease the screen resolution of the shared screen but still is good enough to use. If you want to cast at higher definition then consider purchasing a high speed WiFI
Conclusion
That’s it for this article I hope it helped to cast your android device on Linux. A more detailed and extensive guide is available on Scrcpy’s github page.