0

I was using the term CLI for describing commands like ls. While updating my list of useful commands, I was wondered about one thing. How do we call a shell-like program like mysql for example? doesn't CLI stands for Command Line Interface or Command Line Interpretor? Isn't it more logical to use this term for shell-like programs? After a few research, I was even more confused. Some website used the CLI term to describe the commands, some others for the shell, some for both, some were making a difference between Command Line Interface and Command Line Interpretor, and some were just even more confusing.

So, what exactly is a CLI? What is the term to describe a shell-like program? And a command program? Why is the exact definition so blurry? why isn't everyone in agreement on this?

AdminBee
  • 22,803
Kyrela
  • 41
  • 6
    Don't go too deeply in there. Try to learn to stop worrying and love the ambiguities of human languages and their usage. – ilkkachu Apr 21 '22 at 08:45
  • 1
    I doubt you'll find a "universal" definition of CLI. It's mainly used to contrast the way the user interacts with the computer to a GUI: typing stuff vs. clicking somewhere. "Is the shell or are the commands the real CLI" isn't a question you'd have in that context. – dirkt Apr 21 '22 at 08:48
  • mandatory reading : https://unix.stackexchange.com/questions/33881/what-is-the-difference-between-a-console-shell-terminal-terminal-emulator-te – Archemar Jun 08 '22 at 13:45

3 Answers3

2

I think there is no "exact" definition.

Usually on program documentation, CLI is used about the part which describe the comman line interface, so you get help about arguments and options.

But it is not about shell. You can use the CLI interface also in a program or in a configuration file, e.g. you get pre-hook and post-hook in git, run in other configurations, etc.

Else we tend to use "terminal" (or virtual terminal), or "console" for the interface keyboard and (usually black) screen. But this doesn't imply a shell.

And shell, if I want to stress the shell (which usually run in a terminal). Shell is a program that call other programs (usually showing it with a prompt, and usually with some syntax for redirection and job control, and editing your actual command line).

Above is my interpretation, and it seems the most used one (especially on older programs), But the use is not consistent, as you already discovered.

  • "terminal" or "console" are NOT synonyms for the CLI. The CLI is used to interpret scripts/batch files as well as direct command input. "shell" is mainly a *nix construct and not all shells (for instance the result of a exec(3) call) have CLIs. Other OSes may have CLIs without using shells (for instance OpenVMS). –  Apr 21 '22 at 08:59
  • @Martin: yes, it is complex, and you find CLI used for nearly everything (especially by new programmers). Note: PC DOS 5 publicized their "shell": a graphical interface to call programs. OS/2 IIRC used shell in an analogue way (a program that call other programs, possibly graphically, and not necessary scriptable). PS: I do not mean CLI is a synonym of "terminal" (and I explained the differences), just sometime you find instruction on which may imply that (installations). – Giacomo Catenazzi Apr 21 '22 at 09:08
2

Wikipedia has a good definition:

A Command-Line Interface (CLI) 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.

The term CLI is used in opposition to GUI (Graphical User Interface) which denotes a way for the user to interact with a system through a point-and-click interface, icons, windows, and other graphical components.

Both terms are very wide. To throw in some example, in the Linux/UNIX world, shells (sh, bash, zsh, ...) are CLIs while X Windows environments (GNOME, KDE, ...) are GUIs. Git can be used both through a CLI (git command) and a GUI client.

To answer your question, the term CLI can be used to describe the commands typed on the terminal, and also the shell. As said, it's a broad term.

dr_
  • 29,602
1

CLI is a historical notion.
In the 70's and 80's you had CLI everywhere. It just describe an interface where you interact with commands.
shell, bash, or zhs are a subset of CLI which is a more general term.
Most routers comes with a CLI that is neither of them, and there are tons of programs which are there own CLI.
So CLI is a generic term, shell is a subset of all the CLI that exist.

Kiwy
  • 9,534