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.
Contents
- History
- What is a Terminal?
- What is a Shell?
- What is a command line application?
- Difference between the shell commands and programs
- How to run a command in the terminal?
- Conclusion
- References
History
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).
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.
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.
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.
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.
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.
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 thesed
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.
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 Command Prompt (CMD), Windows
For example, the
cd
command in the Bash shell is a built-in command that allows you to change directories. TheList-Children
command in the Powershell is a built-in command that allows you to list the children of a directory. Thedir
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 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. Thesed
command is another standalone program that you have to install separately.
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.
For example, if you type the
ls
command into the terminal and pressEnter
, the shell will list the contents of the current directory.If you type the
pwd
command into the terminal and pressEnter
, the shell will print the current working directory.If you type the
echo "Hello, World!"
command into the terminal and pressEnter
, the shell will print âHello, World!â.
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.