In the earlier days of general-purpose computers, a keyboard was the only thing you could use to control a computer. For this reason, programmers designed a robust and straightforward shell language that everyone could use to communicate with a computer.

This language is then used on a terminal to do everything, from simple tasks to complex automation. This terminal used to control a computer is known as a command-line interface or CLI.

Today, despite the invention of the mouse and graphical user interface, a CLI is still an important tool used by programmers, network administrators, penetration testers, and power users.

What Is CLI?

A command-line interface or CLI controls a computer by giving it a line of structured keywords. The format of these keywords (commands) is called syntax. The programming language used in a CLI is known as a shell language.

Windows uses what is known as PowerShell, while Linux and macOS use Bash (Bourne Again Shell) and Zsh, respectively. They all have some differences.

The shell languages used in a CLI are easier to learn than regular programming languages like C, Java, and Python. Depending on your usage, controlling a computer using CLI can be as simple as a one-word command or complex composed of multiple lines of CLI commands known as a script.

Now that you know what a CLI is, let's compare it to GUIs and see if people would ever need to use a command-line interface.

Should People Stick to Only Using a GUI?

Command lines on a Mac

A command-line interface (CLI) and a graphical user interface (GUI) are two ways people interact with a computer. As you learned earlier, a CLI commands a device through written commands inside a terminal. In contrast, a GUI is one that everyone is probably using on a day-to-day basis to control their devices.

A GUI is everything graphical illustrated on your display. It is a way to control a device through interactive graphical icons, menus, widgets, images, and just about anything you are seeing on your screen right now.

GUIs have helped make computers as user-friendly as possible. With intuitive illustrations and interactive elements clickable through a mouse, GUIs have allowed all kinds of electronic devices to be used by just about anyone.

With the intuitiveness and the non-existent learning curve to using a GUI, most people won't have a problem interacting with their computers. Indeed, you won't miss a lot from using only a GUI. However, the few times you would need to use a CLI are when it really matters.

For the majority of people sticking to a GUI-only experience should be enough. But there isn't much reason not to learn a few CLI commands. By memorizing only a few keywords and simple syntax, you'll have powerful time-saving commands to save you from all the frustrations of a poorly designed GUI.

To give you an idea of the simplicity of a CLI, here is a command to let you know your computer's complete network information.

Windows:

ipconfig /all

Linux:

ifconfig –a

macOS:

ipconfig getifaddr en0

Here is another command to find your computer's system information:

Windows:

systeminfo

Linux:

sudo lshw

macOS:

system_profiler

Although Mac's Zsh is mostly compatible with Bash, don’t expect common Linux Bash commands to work in macOS flawlessly.

Why Learn CLI?

There are many reasons why people still use command-line interfaces when an aesthetic and straightforward graphical user interface is available.

First of all, a GUI may not always be as straightforward as you think. Have you ever tried looking for a file inside a messy and unorganized folder? With a CLI, you can type in a one-word command plus its name or any identifier and find the file instantly. After you've learned common commands and the syntax, you'll be a much faster user, saving you time.

Another reason to learn CLI is to eliminate tedious and repetitive tasks through automation. With a CLI, you can script a list of commands that your computer will do at any time or in any situation that you choose, just like a to-do list.

For those aspiring to be a network specialist/administrator, learning CLI is essential whether you administrate through Windows, Linux, macOS, Cisco, and Solari. You often won't have time to check every client device inside a network. Using CLI will allow you to take control of every device in a network and properly configure them with ease.

Lastly, a CLI is much more powerful than whatever a GUI will give you. General-purpose computers have so many possible executables that programming a graphical interface for each will bloat the operating system too much. Learning to use CLI can give you a lot of control over your machine.