- What Is a Command Line Interpreter?
- Command line interpreter definition & common command line interfaces
- Other Names for a Command Line Interpreter
- Why Are They Used?
- Not All Command Line Interpreters Are Alike
- More Information on Command Line Interpreters
- What is Command Line Interface (CLI)?
- Command Line Input
- Examples
- Windows Example
- Mac OS Example
- Windows Example
- Basic Linux CLI Commands
- Basic Windows CLI Commands
- DOS Commands Help
- Example
- Command Help
- Example
What Is a Command Line Interpreter?
Command line interpreter definition & common command line interfaces
A command line interpreter is any program that allows the entering of commands and then executes those commands to the operating system. It’s literally an interpreter of commands.
Unlike a program that has a graphical user interface (GUI) like buttons and menus that are controlled my a mouse, a command line interpreter accepts lines of text from a keyboard as the commands and then converts those commands into functions that the operating system understands.
Other Names for a Command Line Interpreter
Any command line interpreter program is also often referred to in general as 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 a command interpreter.
CLI is also an acronym for other technology terms that have nothing to do with a command line interface, such as calling line identfiication, call level interface, cache-line interleaving, clear interrupt flag, and caller location information.
Why Are They Used?
If a computer can be controlled through easy-to-use applications that have a graphical interface, you might wonder why anyone would want to instead enter commands through command line. There are three main reasons.
The first is that you can automate the commands. There are many examples we could give but one is a script to always shut down certain services or programs when the user first logs in. Another can be used to copy files of a similar format out of a folder so you don’t have to sift through it yourself. These things can be done fast 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 command line interface because of that 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 definitely 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 graphical application 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 operating system simply 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, but 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.
Syntax is important, too, because they’re sensitive to the point that any mistyping might be misinterpreted as a totally different command. For example, scannow might be what the program uses 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 Command Prompt. Windows PowerShell is a more advanced command line interpreter available alongside Command Prompt in more recent versions of Windows. Windows Terminal also includes command-line tools but it’s not built-in to Windows.
In Windows XP and Windows 2000, a special diagnostic tool called Recovery Console also acts as a command line interpreter to perform various troubleshooting and system repair tasks.
The command line interface on the macOS operating system is called Terminal.
Sometimes, both a command line interface and a graphical user interface are included within the same program. When this is the case, it’s typical for one interface to support certain functions that are excluded in the other. It’s usually the command line portion that 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.
What is Command Line Interface (CLI)?
CLI stands for:
- Command Line Interface
- Command Line Interpreter
- Command Line Input
Command Line Input
CLI is a command line program that accepts text input to execute operating system functions.
In the 1960s, using only computer terminals, this was the only way to interact with computers.
In the 1970s an 1980s, command line input was commonly used by Unix systems and PC systems like MS-DOS and Apple DOS.
Today, with graphical user interfaces (GUI), most users never use command-line interfaces (CLI).
However, CLI is still used by software developers and system administrators to configure computers, install software, and access features that are not available in the graphical interface.
Examples
The software package manager npm uses command line input to install software:
Windows Example
Mac OS Example
You can navigate your folders (directories) with command line commands:
Windows Example
Use CLI commands with great attention.
Wrong use can easily delete files or destroy your computer system completely.
Basic Linux CLI Commands
Command | Description |
---|---|
ls | List the directory (folder) system. |
cd pathname | Change directory (folder) in the file system. |
cd .. | Move one level up (one folder) in the file system. |
cp | Copy a file to another folder. |
mv | Move a file to another folder. |
mkdir | Creates a new directory (folder). |
rmdir | Remove a directory (folder). |
clear | Clears the CLI window. |
exit | Closes the CLI window. |
man command | Shows the manual for a given command. |
Basic Windows CLI Commands
Command | Description |
---|---|
dir | List the directory (folder) system. |
cd pathname | Change directory (folder) in the file system. |
cd \ | Move to the root folder of the file system. |
cd .. | Move one level up (one folder) in the file system. |
copy | Copy a file to another folder. |
move | Move a file to another folder. |
type filename | Type a file. |
mkdir or md | Creates a new directory (folder). |
rmdir or rd | Removes a directory (folder). |
cls | Clears the CLI window. |
exit | Closes the CLI window. |
help command | Shows the manual for a given command. |
DOS Commands Help
You can display all available commands with the help command:
Example
ASSOC | Displays or modifies file extension associations. |
ATTRIB | Displays or changes file attributes. |
BREAK | Sets or clears extended CTRL+C checking. |
BCDEDIT | Sets properties in boot database to control boot loading. |
CACLS | Displays or modifies access control lists (ACLs) of files. |
CALL | Calls one batch program from another. |
CD | Displays the name of or changes the current directory. |
CHCP | Displays or sets the active code page number. |
CHDIR | Displays the name of or changes the current directory. |
CHKDSK | Checks a disk and displays a status report. |
CHKNTFS | Displays or modifies the checking of disk at boot time. |
CLS | Clears the screen. |
CMD | Starts a new instance of the Windows command interpreter. |
COLOR | Sets the default console foreground and background colors. |
COMP | Compares the contents of two files or sets of files. |
COMPACT | Displays or alters the compression of files on NTFS partitions. |
CONVERT | Converts FAT volumes to NTFS. You cannot convert the current drive. |
COPY | Copies one or more files to another location. |
DATE | Displays or sets the date. |
DEL | Deletes one or more files. |
DIR | Displays a list of files and subdirectories in a directory. |
DISKPART | Displays or configures Disk Partition properties. |
DOSKEY | Edits command lines, recalls Windows commands, and creates macros. |
DRIVERQUERY | Displays current device driver status and properties. |
ECHO | Displays messages, or turns command echoing on or off. |
ENDLOCAL | Ends localization of environment changes in a batch file. |
ERASE | Deletes one or more files. |
EXIT | Quits the CMD.EXE program (command interpreter). |
FC | Compares two files or sets of files, and displays the differences between them. |
FIND | Searches for a text string in a file or files. |
FINDSTR | Searches for strings in files. |
FOR | Runs a specified command for each file in a set of files. |
FORMAT | Formats a disk for use with Windows. |
FSUTIL | Displays or configures the file system properties. |
FTYPE | Displays or modifies file types used in file extension associations. |
GOTO | Directs the Windows command interpreter to a labeled line in a batch program. |
GPRESULT | Displays Group Policy information for machine or user. |
GRAFTABL | Enables Windows to display an extended character set in graphics mode. |
HELP | Provides Help information for Windows commands. |
ICACLS | Display, modify, backup, or restore ACLs for files and directories. |
IF | Performs conditional processing in batch programs. |
LABEL | Creates, changes, or deletes the volume label of a disk. |
MD | Creates a directory. |
MKDIR | Creates a directory. |
MKLINK | Creates Symbolic Links and Hard Links. |
MODE | Configures a system device. |
MORE | Displays output one screen at a time. |
MOVE | Moves one or more files from one directory to another directory. |
OPENFILES | Displays files opened by remote users for a file share. |
PATH | Displays or sets a search path for executable files. |
PAUSE | Suspends processing of a batch file and displays a message. |
POPD | Restores the previous value of the current directory saved by PUSHD. |
Prints a text file. | |
PROMPT | Changes the Windows command prompt. |
PUSHD | Saves the current directory then changes it. |
RD | Removes a directory. |
RECOVER | Recovers readable information from a bad or defective disk. |
REM | Records comments (remarks) in batch files or CONFIG.SYS. |
REN | Renames a file or files. |
RENAME | Renames a file or files. |
REPLACE | Replaces files. |
RMDIR | Removes a directory. |
ROBOCOPY | Advanced utility to copy files and directory trees. |
SET | Displays, sets, or removes Windows environment variables. |
SETLOCAL | Begins localization of environment changes in a batch file. |
SC | Displays or configures services (background processes). |
SCHTASKS | Schedules commands and programs to run on a computer. |
SHIFT | Shifts the position of replaceable parameters in batch files. |
SHUTDOWN | Allows proper local or remote shutdown of machine. |
SORT | Sorts input. |
START | Starts a separate window to run a specified program or command. |
SUBST | Associates a path with a drive letter. |
SYSTEMINFO | Displays machine specific properties and configuration. |
TASKLIST | Displays all currently running tasks including services. |
TASKKILL | Kill or stop a running process or application. |
TIME | Displays or sets the system time. |
TITLE | Sets the window title for a CMD.EXE session. |
TREE | Graphically displays the directory structure of a drive or path. |
TYPE | Displays the contents of a text file. |
VER | Displays the Windows version. |
VERIFY | Tells Windows whether to verify that your files are written correctly to a disk. |
VOL | Displays a disk volume label and serial number. |
XCOPY | Copies files and directory trees. |
WMIC | Displays WMI information inside interactive command shell. |
Command Help
For more information on a specific command, type help + command-name
Example
Displays or sets the date.
Type DATE without parameters to display the current date setting and
a prompt for a new one. Press ENTER to keep the same date.
If Command Extensions are enabled the DATE command supports
the /T switch which tells the command to just output the
current date, without prompting for a new date.