Command Line Interface (CLI)

Command Line Interface (CLI)

A command-line interface, often abbreviated as CLI, is a computer interface where the primary form of input and output is text. CLIs are keyboard-driven linear interfaces. The command-line interface is an alternative to a graphical user interface, or GUI, where input and output are primarily visual and driven by a mouse or pointing tool.

While GUIs have replaced CLIs as the primary mode of interaction, almost all operating systems still offer a command-line interface to interact with the system. The reason for offering a CLI as an optional feature is because CLIs are easier to script/automate. Also, CLIs can access deeper functionality that might not be accessible from a GUI targeting non-experienced consumers.

Shells based on CLIs issue commands to the operating system. The output from the command can either be displayed back to the screen or a file on disk.

What are some widely used CLI shells?

What is the structure of a CLI command?

Conventionally each entity in the input is delimited by a space. The command is issued to the shell by pressing Enter.

A shell command consists of a command followed by several parameters given as inputs to the command. The command may be an internal command handled by the CLI shell, an included program for the operating system's primary activities, or an executable program installed by the user or third-party for various specific purposes.

   command param1 param2 ...

Parameters can are generally referred to by other names such as arguments (representing open-ending inputs to the command), options (representing pre-configured modes of operation given by the command), or flags (representing binary switches provided by the command). People use these names interchangeably, and the definitions are essentially by convention.

Write clean and secure code with DeepSource

Powerful static analysis that takes 5 minutes to set up and helps you fix code health and security problems on every pull request.