Yes, Android has a command-line interface just like a desktop GNU/Linux system. But because it's an embedded system without storage space to throw away on features most users don't want, there aren't a lot of commands installed by default: just some specific ones used to interact with Android services (such as
pm). Because the manufacturer can customize the system image, there's no definitive list of what commands are available: it varies from device to device.
To add more commands, you can install Busybox, which is a single package containing a set of the most-used Unix command-line utilities. There are several "Busybox installer" apps on Google Play, but as it's open-source, you can also install it from F-Droid or build it yourself from source.
As you've already seen, there's a wide variety of terminal emulator apps. These run on your Android phone and provide a window into which you can type commands and see the results. Often they come with SSH clients and the like built-in, because the most common use for a terminal emulator on an Android phone is to SSH into a bigger computer.
In addition, running
adb shell from a desktop computer that's connected to the phone via ADB gives you a shell on the phone. You can instead run
adb shell command to run
command in a shell on the phone.
Neither of the above methods of starting a shell make you root by default, but if your phone is rooted, you can use the
su command in the usual way to become root. Whichever root manager you have on your phone (Superuser, SuperSU, etc.) will probably pop up on the screen for you to confirm the root access.
Shell scripts run on Android in the usual way, but as I've already mentioned, you don't get a lot of commands to play with by default, so many scripts written for desktop simply won't work.