A command line interface (CLI) is a man-machine interface in which the communication between the user and thecomputer takes place in text mode :
the user types a line control , that is to say to the text on the keyboard instruct the computer to perform an operation;
the computer displays text corresponding to the result of the execution of typed commands or questions that asks the user software.
A command line interface can be used both to launch the implementation of various programs through a shell , for dialogues with the user software. It is theinteraction between a fundamental human and a computer (or other equipment).
When an interface is ready to receive a command, it indicates a command prompt. The latter, sometimes called the Anglicism prompt , consists of a few characters at beginning of line (typically the name of the user account, and / or logical drive default and / or default path and / or date, ...), ending with a well-known character (usually "]", "#" or ">"), prompting the user to enter a command.
The command line interface for Unix
One of the peculiarities of the operating system Unix , including Linux is derived, that is, from the outset, it has had more than a hundred software, often making treatments very simple, all usable from the command line.
Syntax general orders
Basic Unix commands are of the form:
The command appears at the beginning of the line is almost always the name of software. This software can control the operating system, software written by a user (often in C language ) or a shell . Few commands such as cd (c hange d eature / directory ) can not be correctly processed by specific software. In this case they are executed directly by the shell .
Some of these commands can be run by typing their name only. But most of the commands accept options (a hyphen followed by one or more letters) that can use the command other than in its default mode of operation. Finally, many commands are followed by one or more names of file , directory, or other, with whom they will work. All information separated by spaces to the right of the command name are called arguments of the command line.
The C language has been designed to easily retrieve arguments from the command line software that uses them. Finally, to know how to use software, documentation ( Man pages ) is available to the user. It works by prefixing the command withman.
Redirects I / O
By default, conversational commands retrieve data typed by the user at the keyboard. The result of their execution is displayed on the screen. If run-time error, the error messages also appear on the screen.
It is possible to indicate to the shell as input data or output must be retrieved / stored in files rather than the keyboard and the screen.For this purpose, different types of redirection of inputs / outputs are available:
> Output means that the data generated by the command are written to the output file name rather than the screen. If the output file already exists, its previous contents are deleted, otherwise the file is created to launch the command.
>> Output similar to the previous case except that if the output file already exists, its previous contents are preserved ...