*nix and ssh pretty much go hand in hand
Install termux from playstore and that gives you a terminal on your android phone.
apt update
apt upgrade
and you're ready to install packages
apt install openssh
and ssh is ready to go. But before starting a sshd (ssh server) set the password
passwd .... and enter a password you'll remember
then run
sshd ... to start the sshd server (that listens to port 8022)
(pkill sshd ... kills it)
Ignores the userid so anything for that will do.
Run ifconfig to identify your local IP, maybe something like 192.168.1.15
From your desktop ssh -p 8022 anyuserid@192.168.1.15
and enter the password and you have a android terminal session
To avoid having to enter the password each time set up a key by running (on your desktop system)
ssh-copy-id -p 8022 anyuserid@192.168.1.15
Nice if you also install adb. If you don't run sshd on your desktop such that the default ssh port (22) is free then you might
adb forward tcp:22 tcp:8022
so the android becomes the sshd server and you can access that using
ssh abc@localhost ... to get a android terminal
scp somefile abc@localhost:/path/filename
to copy a file from the desktop to the android
scp abc@localhost:/path/filename somefile
to copy from the phone to the desktop
OR
mkdir mp
sshfs abc@localhost:/path/folder mp
to mount a android folder to folder mp on the desktop, and then use rox to drag/drop files between the two devices.
If you edit/create a .profile in the home folder of termux and add to that
sshd
then sshd will start each time you start termux
ssh is very widely used/available and whilst the configuation of ssh/sshd varies, once you have a core understanding of the general concepts/methods that knowledge/functionality is very portable.
=======
scrcpy works well at having a window of your android on your desktop that you can control with the mouse/keyboard, and along with ssh (and assuming you have xdotools installed on your desktop system) you can do tricks such as opening up the Tether screen on the phone from your desktop and have xdotools step between the options and make selections.
#!/bin/sh
xterm -e 'scrcpy' &
PID=$!
sleep 2
ssh -p 8022 abc@192.168.1.15 'am start -S com.android.settings/.TetherSettings'
sleep 2
xdotool key Down # Step to tether option
sleep 1
xdotool key Return # select it
sleep 1
xdotool key Tab # Confirmation requires tab tab Enter
sleep 1
xdotool key Tab
sleep 1
xdotool key Return
For me for instance starts scrcpy and opens up the config screen that includes tethering, steps down to the relevant choice and presses enter to toggle it, and the tab/tab/return steps through the next popup that asks for confirmation.