14 Aug 2024 ~ 6 min read

The Terminal from Start to Workable

Starting up the terminal always seemed intimidating? Let's break it down from the start to make it workable. It's just another very useful tool in your toolbox.

Listen to something with me 😍

Want to listen somewhere else? 🎧

Contents

History

Terminal Program Computer Terminal, Wikipedia

Historically, a terminal is a piece of equipment that is used to interact with a computer. It’s a screen and a keyboard that allows you to type commands and see the output of those commands. The terminal is a text-based interface to the computer. It’s a way to interact with the computer without using a graphical user interface (GUI).

Terminal Program CMD running in Windows XP

Today terminal is a software application that emulates the functionality of the old hardware terminals. It’s a program that runs on your computer and allows you to type commands and see the output of those commands in a text-based output.

Top

What is a Terminal?

A terminal is a program that allows you to interact with your computer using text commands. It’s a way to run programs, manage files, and perform other tasks without using a graphical user interface (GUI). The terminal is also known as a command line interface (CLI) or shell.

Image of CMD on windows The popular Windows terminal, Command Prompt (CMD)

If you’re using Windows, you might be familiar with the Powershell program or the Command Prompt (CMD) program. These are examples of terminal programs that allow you to interact with your computer using text commands.

Image of Ubuntu Terminal Program The default Gnome Terminal application running bash, on Ubuntu Linux

If you’re using a Mac or Linux, you might be familiar with the Terminal program, yes literally named “Terminal”. This is another example of a terminal program that allows you to interact with your computer using text commands.

Top

What is a Shell?

A shell is a program that interprets the commands you type into the terminal and runs them on your computer. It’s the like the middleman between you and the computer. The shell takes the commands you type and translates them into instructions that the computer can understand.

The shell runs in the terminal program and provides a way for you to interact with your computer using text commands. While there are a number of different shells available, the most common shell on Unix-based systems is the Bourne Again or the Bash shell. On Windows machines the most common shell program is the Command Prompt (CMD), but in recent years it is being replaced by the Powershell program.

Top

What is a command line application?

A command line applications are programs you can run from the terminal, also known as CLI applications. They are programs that can take input from the terminal and display output to the terminal using text. Command line applications are often used for system management tasks, automation, and other tasks that don’t require a graphical user interface.

We come across CLI application usage in devops, system admin work and software development. The main reasoning behind using CLI applications, the ability to aggregate and compose complex tasks. You can chain multiple CLI applications together to create powerful workflows.

For example, you can use the grep command to search for a specific pattern in a file, and then use the sed command to replace that pattern with another pattern. So you might take a file with a list of names, search for all the names that start with the letter “A”, and then replace them with names that start with the letter “B”.

And you can save this task as a script and run it whenever you need to perform this task. This is the power of CLI.

Top

Difference between the shell commands and programs

Shell commands are built-in commands that are provided by the shell program itself. These commands you don’t have to install separately, they are part of your shell program.

Image of "dir" running in CMD Image of “dir” running in Command Prompt (CMD), Windows

For example, the cd command in the Bash shell is a built-in command that allows you to change directories. The List-Children command in the Powershell is a built-in command that allows you to list the children of a directory. The dir command in the Command Prompt (CMD) is a built-in command that allows you to list the contents of a directory.

Image of "grep" running in Ubuntu Terminal Image of “grep” running in Kitty Terminal, MacOS

CLI programs are standalone programs that you have to install separately, these programs are not part of the shell.

For example, the grep command is a standalone program that you have to install separately. The sed command is another standalone program that you have to install separately.

Top

How to run a command in the terminal?

To run a command in the terminal, you simply type the command into the terminal and press the Enter key. The shell will interpret the command and run it on your computer. If there is an output from the command it will be displayed in the terminal, below the command you typed.

Image of "ls" running in MacOs Terminal, ZSH

For example, if you type the ls command into the terminal and press Enter, the shell will list the contents of the current directory.

If you type the pwd command into the terminal and press Enter, the shell will print the current working directory.

If you type the echo "Hello, World!" command into the terminal and press Enter, the shell will print “Hello, World!“.

Top

Conclusion

The terminal is a powerful tool that allows you to interact with your computer using text commands. It’s a way to run programs, manage files, and perform other tasks without using a graphical user interface (GUI). The terminal is also known as a command line interface (CLI) or shell.

References


Headshot of Maxi Ferreira

Hi, I'm Zablon. I'm a software engineer, mostly working in the web space, based in Ethiopia. You can follow me on Twitter, see some of my work on GitHub, or read more about Qebero.dev on here.