If you have installed “adb” command as mentioned in “How to Install ADB and Fastboot on Ubuntu ?“
Use below commands to connect to your device / mobile phones shell,
First using “adb devices” command, make sure we have device properly connected to Laptop/Desktop.
$ adb devices
List of devices attached
B2NGAA8831702707 device
If you don’t see any output from above command, it means the cable is not properly connected or adb debugging is not enabled in your mobile phone. Go to phone settings and enable android debugging support over USB.
To, connect to shell,
$ adb shell
If by any means, you are able to see serial number in “adb devices” but not able to connect, you can try to kill adb server and restart the same again and try as,
$ adb kill-server
$ adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
If you want to restart your device,
$ adb reboot