How to root Android Jelly Bean from terminal inside Android
No. On a few devices' stock ROMs it's possible to use a security vulnerability in a driver or the kernel to root the device from the device itself, but they generally require a specific app to work (such as Framaroot for the devices and ROMs it supports). AFAIK, there isn't a single device you can exploit this way to get root from the command-line. On devices without such a vulnerability, you can only unlock the bootloader from fastboot, which requires you to be in fastboot mode, or some equivalent vendor-specific tool.