Command-Line Interface

Command-Line Interface

What is a command-line interface?

A command-line interface (CLI) is a text-based user interface (UI) used to run programs, manage computer files and interact with the computer. Command-line interfaces are also called?command-line user interfaces,?console user interfaces?and?character user interfaces. CLIs accept as input?commands?that are entered by keyboard; the commands invoked at the?command prompt?are then run by the computer.

Today, most vendors offer the graphical user interface (GUI) as the default for?operating systems?(OSes) such as Windows, Linux and macOS. Most current?Unix-based?systems offer both a command-line interface and a graphical user interface.

The?MS-DOS?operating system and the command shell in the?Windows operating system?are examples of command-line interfaces. In addition, programming language development platforms such as Python can support command-line interfaces.

The command line dropped in popularity following the introduction of GUI-based personal computer OSes like Microsoft Windows and Apple's "classic" Mac OS in the 1980s. The command line remains an important tool for IT professionals, software developers,?sys admins, network administrators and many others who prefer a more precise and reproduceable interface to their systems.

What is a shell?

In computing, a shell program provides access to an operating system's components. The shell gives users (or other programs) a way to get "inside" the system to run programs or manage configurations. The shell defines the boundary between inside and outside.

The following are the two types of operating system shells:

  • CLI-based shells offer users a concise and efficient mode of interacting with the OS, without requiring the overhead of a graphical user interface.
  • GUI-based shells are considered easier for beginners to use, but they also include a CLI-based shell for system administrators or power users who prefer to interact at a command prompt.

Bash?is the most commonly used command-line shell for Unix-based OSes including Linux.

The software that handles the command-line interface is commonly referred to as a command language interpreter, a command processor or command interpreter. Two well-known CLI shells are?PowerShell?for Windows and Bash for?Linux?and?macOS.

Shells are the outermost layer of the OS and are often separated from the underlying OS?kernel. A shell operates like an application and can be replaced as needed. An OS may have more than one shell available, as in the following examples:

  • Microsoft Windows includes the?Command Prompt app as well as the PowerShell application, both of which can be used to interact directly with the computer. The?Windows Subsystem for Linux?also provides a CLI with access to the underlying system.
  • Linux and other Unix-based operating systems usually provide the Bourne-Again Shell (bash) as the default shell. Other shells, including the C shell, Z shell and others, can be configured as the default system shell.

Because the shell is only one layer above the OS, users can perform operations that are not available in other interface types, such as moving files within system folders and deleting locked files.

To get the greatest benefit from using a CLI shell, users should learn a?scripting language. Most command line shells can save sequences of commands in a?script?or batch file which may be fully programmable. Shell scripting is the foundation of basic?systems management?automation.

How do CLIs work?

Once a computer system is running, its CLI opens on a blank screen with a command prompt and commands can be entered.

Types of CLI commands include the following:

  • system commands that are encoded as part of the operating system interface;
  • executable programs that, when successfully invoked, run text-based or graphical?applications; and
  • batch programs (or?batch files?or?shell scripts) which are text files listing a sequence of commands. When successfully invoked, a batch program runs its commands which may include both system commands and executable programs.

CLI is more than a simple command/response system, as most have additional features that make one preferable to another. Some features include the following:

  • Scripting capability?enables users to write?programs?that can be run on the system from the command line.
  • Command pipes?enable users to direct the output of one program to be the input for another program ("piping" the flow of data).
  • System variables?can be set at the command line, or the values of those variables displayed.
  • Command history?features enable the user to recall previous commands issued. Some save command history for the session (like PowerShell), others can be configured to store session history for longer (like bash).

要查看或添加评论,请登录

NISHI KUMARI的更多文章

  • What is CRUD?

    What is CRUD?

    CRUD refers to the four basic operations a software application should be able to perform – Create, Read, Update, and…

  • What is Financial Modeling and How to Build it?

    What is Financial Modeling and How to Build it?

    Financial Modeling is defined as the process of developing a mathematical model or representation of a business's…

  • What is a SQL Stored Procedure?

    What is a SQL Stored Procedure?

    A SQL Stored Procedure is a collection of SQL statements bundled together to perform a specific task. These procedures…

  • Data Analysis Expressions (DAX)

    Data Analysis Expressions (DAX)

    Data Analysis Expressions (DAX) is a formula expression language used in Analysis Services, Power BI, and Power Pivot…

  • What is Django Web Framework?

    What is Django Web Framework?

    Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It follows…

  • What is Email Marketing?

    What is Email Marketing?

    Email marketing refers to a digital marketing strategy that uses email to promote business offerings and build…

  • SQL Query Performance

    SQL Query Performance

    To improve SQL query performance, it’s crucial to understand the factors that can impact its efficiency. Various…

  • Apache HBase

    Apache HBase

    Apache HBase is an open-source, distributed, column-oriented database modeled after Google's Bigtable. It is developed…

  • What is graphic design?

    What is graphic design?

    Graphic design is a form of communication that uses colors, shapes, images, and words to create visual content in many…

  • Azure Synapse

    Azure Synapse

    Azure Synapse is an enterprise analytics service that accelerates time to insight across data warehouses and big data…

社区洞察

其他会员也浏览了