Many traditional command line tools are available from Google Play.
The official way to gain root (for Nexus devices, some other manufacturers ship modified Android versions that may make this harder) is documented in the official Android documentation: http://source.android.com/source/building-devices.html (unlock the bootloader using fastboot and install sudo from Google Play).