Week 1, Episode 1 [Pilot]
Estimated Reading Time: 35 secs
Last week was my first week at ALX-Holberton, and God, was it exciting!
I intend to use these episodes to do two things:
One of the concepts we learned last week in #ALX_SE was shell navigation.
Words like shell, terminal, and command line interface (CLI) were thrown around.
The resources we were given to learn on our own covered shell navigation, but I had questions in another direction.
What’s even a shell? Is it the same thing as a terminal? And what’s a command line?
To my surprise, there’s a lot of confusion around these terms on the web. They’re often used interchangeably, but they refer to different things.
So I dug some more and arrived at a clear distinction.
The Difference Between Shell, Terminal, and Command-Line Interface
Estimated Reading Time: 3 mins 5 secs
To answer this question, we need to understand one thing about computers.
Computers are like servants.
Yes, below the surface, they seem intimidating. But at the end of the day, they take instructions (aka., commands) from humans.
You can give commands to a computer through two interfaces: the graphical user interface (GUI) or the command line interface (CLI).
You’re already familiar with the GUI.
It’s the icons, buttons, windows, etc., on your computer screen. Usually, you need a mouse and keyboard to interact with a GUI.
For instance, if you want to command your computer to open Microsoft Word, you simply double-click on the MS Word icon.
The CLI, on the other hand, is a text-based interface for giving commands to a computer. There are no icons, buttons, etc. Just text.
To access the CLI, you can use the terminal. So what’s a terminal?
Now, when people say terminal, they often mean a terminal emulator. But a terminal and a terminal emulator are two different things.
Terminal versus Terminal Emulator
A terminal is a physical device used, in early computing, to interact with a central computer.
Terminals were often connected to a central computer. They displayed data from the central computer, and could also be used to input data into the central computer.
Terminals are text-based, so no icons, buttons, etc. Just text.
Terminals do NOT use a mouse. They use a keyboard to instruct the computer on what to do (i.e., give commands) and display output through their screen.
Hence, text input was entered through keyboards, and output was through the screen of the terminal.
领英推荐
We no longer use terminals.
A terminal emulator is a software program that emulates the functionality of the traditional terminal.
Like a terminal, it provides a text-only interface to a computer, but it’s a software program, not a physical device.
For this reading, we’ll refer to a terminal emulator as a terminal.
Terminal versus CLI
As I said earlier, you can access the CLI through the terminal.
There are other ways to access a CLI apart from a terminal, but we won’t go into those here.
Note: the terminal can also provide access to the GUI, not only the CLI.
The terminal is a program, while the CLI is a user interface. This is their main difference, though they’re often used interchangeably.
In addition, the cursor point (or line) in a terminal where you type commands is called the command line.
This command line is why a terminal is sometimes referred to as a “command-line interface (CLI),” but they’re two different things.
The terminal is like a window into the computer, while the CLI is like a toolbox behind the window that you use to interact with the computer.
So, recap:
A terminal is a program that provides a text-based interface to a computer.
A CLI is a user interface that enables users to type in commands to a computer.
So where does the shell fit in all these?
The Shell
Agreed, the command line is the line where you type in commands to the computer. However, the command line is NOT provided by the terminal even though it is a part of the terminal.
The command line is provided by the shell.
It is the shell that takes your command, interprets it, executes it, and presents the output of a command to the terminal window.
To fully understand the shell, let’s visit your operating system (OS).
Your OS might be Windows (from Microsoft) or macOS (from Apple Inc.). The shell is a part of your OS.
The shell is responsible for interpreting and executing commands you enter via the CLI.
When it’s done executing, it presents the output to the terminal window.
So the shell acts as a middleman between you and your computer’s OS.
The primary function of the terminal, on the other hand, is to accept textual input from you and render text-based outputs of your commands, just like a traditional terminal.
In conclusion, let’s summarize the differences.
Terminal, CLI, Command Line versus Shell
Do you have any analogy to help me understand these terms better or corrections to statements I’ve made in this article?
Kindly drop them in the comments section.
Thank you for reading!
Additional Resources:
Check out this video of a computer terminal.
Backend Software Engineer || Cinematographer
1 年Yes, very useful... I will suggest you share the link to this page with ALX-SE groups for more reach. I had to take a course on File and Folder Management today on Udemy, it has improved my understanding of Shell.
Backend Software Developer | ALX Alumni | Low-Level Programming & System Design | Python & C | Shell Scripting | Pointers Expert
1 年Man Of God this is succint: