How do I turn off USB tethering or restart USB connection via computer/PC's terminal?
Fastest, foolproof way is just unplug it, that terminates the connection and the service. Otherwise the answer above is useful, or you could just issue adb reboot (assuming you have USB debugging on). Otherwise you'd need to find the PID in your PC operating system and stop that service.
Running the following command as root should enable USB tethering:
service call connectivity 32 i32 1 on Ice Cream Sandwich (4.0) service call connectivity 33 i32 1 on Jelly Bean (4.1 to 4.3) service call connectivity 34 i32 1 on KitKat (4.4) service call connectivity 30 i32 1 on Lollipop (5.0)
See further information in his answer.
Setup ADB in PC, enable USB debugging, launch Terminal/CMD in PC and enter:
adb shell su -c "<cmd>"
<cmd>" with the relevant aforesaid command to enable USB tethering. Change
0 to disable USB tethering.
E.g. For My Jelly Bean 4.2.1, the commands would be:
Enable USB tethering
adb shell su -c "service call connectivity 33 i32 1"
Disable USB tethering
adb shell su -c "service call connectivity 33 i32 0"