Command line interpreter definition & common command line interfaces
A command line interpreter is any program that allows one to enter commands and then execute those commands to the operating system. It’s an interpreter of commands.
Unlike a program that has a graphical user interface (GUI) like buttons and menus that a mouse controls, a command line interpreter accepts lines of text from a keyboard as the commands and then converts those commands into functions that the OS understands.
Why Are They Used?
If a computer can be controlled through easy-to-use applications with a graphical interface, you might wonder why anyone would want to enter commands through the command line instead. There are three main reasons.
The first is that you can automate the commands. I could give many examples, but one is a script to shut down certain services or programs when the user first logs in. Another can be used to copy files of a similar format from a folder so you don’t have to sift through it yourself. These things can be done quickly and automatically by using commands.
Another benefit to using a command line interpreter is that you can have direct access to the functions of the operating system. Advanced users may prefer the concise and powerful access that it gives them.
However, simple and inexperienced users don’t usually want to use a command line interface because they’re not as easy to use as a graphical program. The available commands are not as obvious as a program that has a menu and buttons. You can’t just open a command line interpreter and immediately know how to use it like you can with a regular app you might download.
Command line interpreters are useful because while there may be a huge number of commands and options for controlling an operating system, it’s possible that the GUI software on that OS isn’t built to utilize those commands. They also let you use some of those commands while not having to use all of them at once, which is beneficial on systems that don’t have the resources to run a graphical program.
Not All Command Line Interpreters Are Alike
When a command line interpreter understands a specific command, it does so based on the programming language and syntax. This means that one command that works in one situation under a particular operating system and programming language might not work the same way (or at all) under a different environment.
For example, one platform might use the command scannow to scan the computer for errors. Still, another program or operating system that doesn’t have that capability built in might do nothing. Or, if it has a similar function, the command line interpreter might only understand scan or scantime, for example.
The syntax is important, too, because they’re sensitive to the point that any mistyping might be misinterpreted as a different command. The program might use scannow to start a scan, but if you remove the last letter, scanno might be how it understands when it should stop the scan.
More Information on Command Line Interpreters
In most Windows operating systems, the primary command line interpreter is the Command Prompt. Windows PowerShell is a more advanced command line interpreter available alongside Command Prompt in more recent versions of Windows.
The command line interface in Linux and macOS is called Terminal.
A command line interpreter and a GUI are sometimes included within the same program. When this is the case, it’s typical for one interface to support certain functions that are excluded from the other. Usually, the command line portion includes more features because it provides raw access to the application files and isn’t limited by what the software developer chose to include in the GUI.
Other Names for a Command Line Interpreter
Any command line interpreter program is also generally called a command line interface. Less commonly, it’s also called a CLI, command language interpreter, console user interface, command processor, shell, command line shell, or command interpreter.
FAQ
- What do you type to access the interactive Python interpreter from the command line? Enter python in the Mac OS or Linux command line to run the interactive Python interpreter. On Windows, open Command Prompt and enter py.
- How do you exit the Python interpreter from the command line? Use the exit() function when you want to end your interactive Python session. Alternatively, you can use the keyboard shortcut Ctrl+Z, then press Enter to return to Command Prompt in Windows.
- What is a command line interpreter known as in Unix terminology? A command line interpreter in Unix is commonly called a shell.
- How do you open Matlab from a command line interpreter? Run Matlab from a command prompt using the command matlab. If you want to open Matlab without the splash screen, use the command matlab -nosplash. To record the exit code, use the command matlab -wait.