WHAT IS COMMANDLINE INTERFACE
A command-line interface processes commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor.
ommand line interface (CLI) is a text-based interface that is used to operate software and operating systems while allowing the user to respond to visual prompts by typing single commands into the interface and receiving a reply in the same way.
CLI is quite different from the graphical user interface (GUI) that is presently being used in the latest operating systems
CLI is an older method for interacting with applications and operating systems and is used to perform specific tasks required by users. CLI is a text-based interface, unlike the GUI, which uses graphical options that enable the user to interact with the operating system and applications.
CLI allows a user to perform tasks by entering commands. Its working mechanism is very easy, but it is not user friendly. Users enter the specific command, press “Enter”, and then wait for a response. After receiving the command, the CLI processes it accordingly and shows the output/result on the same screen; command line interpreter is used for this purpose.
CLI was introduced with the teletypewriter machine. This system was based on batched processing. Modern computers support CLI, batch processing and GUI in one interface.
In order to best make use of CLI, a user must be able to enter a bundle of commands (one by one) quickly. There are many applications (mono-processing systems) that still use CLI for their operators. In addition, some programming languages, such as Forth, Python and BASIC, offer CLI. Command line interpreter is used to implement the text-based interface.
Another feature of CLI is command prompt, which is employed as a sequence of characters used in the user interface, or shell. Command prompt is used to notify users that CLI is ready to accept commands.
MS-DOS is the best example of CLI.
Abbreviated as CLI, a Command Line Interface connects a user to a computer program or operating system. Through the CLI, users interact with a system or application by typing in text (commands). The command is typed on a specific line following a visual prompt from the computer. The system responds to the text, and the user may then type on the next command line that appears. Through this command and response interaction, the user is able to issue a series of commands, which are executed by the system or program. Systems and software can provide users with both CLI and Graphical User Interface (GUI) options.
TYPES OF COMMANDLINE INTERFACE
There are many different types of command line interfaces, but the two most popular ones are DOS (for Windows) and the bash shell (for Linux and OS X). Each CLI uses its own command syntax but they all function in a similar way. For example, every CLI has a COMMAND PROMPT, which is displayed when the interface is ready to accept a command. When you type a command, it shows up next to the command prompt, and when you press Enter, the command is executed.
Below are some examples of command prompts for different command line interfaces, with the root folder as the current directory.
- Windows (DOS): C:\>
- OS X (bash shell): My-iMac:/ me$
- Linux (bash shell): [root@myserver /]#
The standard way to change directories in most CLIs is to use the command cd, followed by the directory path. If you are using Windows, you can type cd C:\Users to access the Users folder. If you’re using OS X, you can type cd /Volumes/SSD/Users (assuming the drive name is “SSD”). A few other commands are identical between DOS and the bash shell, but each CLI supports many different commands as well. For example, to list the contents of the current directory, you would type dir in DOS and ls in the bash shell
Most people prefer a standard graphical user interface to a command line one. However, some operations can actually be completed faster using a keyboard instead of a mouse. Therefore, CLIs are often used by network administrators and webmasters for common tasks like transferring files and checking server status.
Command Line Features
Following are some of the Command Line Features :
History option enables TL1 Agent to record all the commands which are executed in the history list. You can use UP-arrow or DOWN-arrow keys to traverse the history list. You can traverse the history list and modify or execute the command.
Typing a letter (starting letter of the command) and pressing Tab key completes the TL1 command code. If more than one command code is registered starting with the typed letter, then all the matching ones are listed. Pressing the Tab key after entering the full command code displays the command syntax.
Commands can be edited from command line using LEFT arrow key, RIGHT arrow key, and <DEL> key.
Pressing “?” lists all the commands available for accessing the Agent. Pressing a command and “?” lists the matching command codes.
Typing a command and pressing Tab key lists the complete command along with the usage for the command.
Typing a command and pressing ESC key clears the current line of text and returns to TL1 Prompt
How to use the CLI?
Once a user has entered a command in the terminal command prompt, the CLI accepts what the user has typed and passes it to a shell. The shell is the command-line interpreter that translates commands entered by a user into actions to be performed by the operating system. If the command produces an output, then the text is displayed in the terminal. If problems with the command are encountered, an error message is displayed.
The shell has some popular features like:
- Scripting: The ability to place commands in a file and then interpret the file, resulting in all of the commands being executed. This feature also has some programming features, such as conditional statements and the ability to create functions (AKA subroutines).
- Aliases: The ability to create short nicknames for more extended commands.
- Variables: Used to store information for the shell and the user. These variables can be used to modify how commands and features work as well as provide vital system information.
CLI advantages and disadvantages
The advantages of a command-line interface are:
- greater control of an OS or application;
- faster management of many operating systems;
- ability to store scripts to automate regular tasks;
- basic command-line interface knowledge to help with troubleshooting, such as network connection issues.
The disadvantages of a command-line interface are:
- GUI is more user-friendly;
- steeper learning curve associated with memorizing commands and complex syntax/arguments;
- different commands used in different shells.
Drop your comment