Bash command to Connect and Disconnect Wireless ADB Linux

These one command will give you the ability to connect android device in a same network.

assume you are using zsh and .zshrc. if it's not the case change >> ~/.zshrc to >> ~/.bashrc

echo -e "\nexport phoneip=\$(adb shell \"ip addr show wlan0 | grep -e wlan0\$ | cut -d' ' -f 6 | cut -d/ -f 1\")  
function adbwifi() {  
    local port=\${1:-5555};  
    adb tcpip \$port && adb connect \$phoneip:\$port;  
}  
function adbwifidc() {  
    local port=\${1:-5555};  
    adb disconnect \$phoneip:\$port;  
}" >> ~/.zshrc

connect command : adbwifi <PORT>
disconnect command : adbwifidc <PORT>

<PORT> is optional defaults to 5555


You'll only receive email when they publish something new.

More from Rifky Adni Putra
All posts