DEV Community

loading...
Cover image for Let’s explore: what is a shell and terminal?

Let’s explore: what is a shell and terminal?

cseeman profile image christine Originally published at christine-seeman.com on ・4 min read

I still feel new to the world of terminals, consoles, and yes, shells. Being a Java engineer for 12 years really didn’t expose me much to these concepts in my day-to-day work, but now as a Ruby on Rails engineer, it is my preferred way of interacting with my tests, servers, git ... With Java, my day was just working in my IDE (Integrated Development Environment) which was Eclipse or pretty much Eclipse (I’m looking at you Spring Tool Suite). Sometimes I really feel like I am out of step when I start hearing folks discuss bash vs zsh or vim vs emacs, admittedly I am not quite sure what a kernel is either.

What is a shell?

So I thought I would take myself to step one, and answer the question, what even is a shell? It seems like something that is mixed up with a terminal, and frankly I can’t keep them apart. So let’s untangle that mess.

University of Chicago professor Benjamin Soltoff has a great write-up about this, which summarizes:

The shell is a program on your computer whose job is to run other programs, rather than do calculations itself. The shell is a very old program and in a time before the mouse it was the only way to interact with a computer. It is still extremely popular among programmers because it is very powerful, fast, and is particularly powerful at automating repetitive tasks.

https://cfss.uchicago.edu/setup/shell/

So a shell helps with interactions between programs, maybe even programs and the operating system (OS)... clear as mud there. Let's dig deeper, maybe by tracking down the definitions of terminal, and console, it might make more sense.

What is a terminal?

According to The Linux Information Project

A terminal window, also referred to as a terminal emulator, is a text-only window in a graphical user interface (GUI) that emulates a console.

http://www.linfo.org/terminal_window.html

Ok. So a terminal allows a user to enter text and use commands through command-line interfaces (CLI) and text user interface (TUI) applications. Some examples terminal apps are iTerm2, Window Terminal, and Linux console.

Ok, so terminal might be the application you open for running commands such as git commands, or booting up your rails server. I know on my system my terminal is iTerm2. Adding in what we now know about shells and terminal, it seems like these two definitely work together. So the terminal is where your shell is used. They are pretty intertwined, in that you can’t really use your shell without a terminal! No wonder people have a hard time breaking them down.

How do I tell what I am using?

Well in the case of the terminal, what is the application you are opening up? For me, I know because I am hitting the little iTerm icon:

iTerm’s icon

Try searching for “Terminal” on your OS, and see what pops up. The default MacOS Terminal app is usable for when you want to dip your toes finding out what a terminal is about, but lots of devs prefer something a little bit more customizable.

In the case of your shell, you need to boot up your terminal app and put in a command. One to try could be echo $SHELL (echo is a command to output that argument of $SHELL which should correspond to what is our system level shell program). Or give echo $0 a go. Testing out those commands shows that I am using a bash shell:

Trying out echo $SHELL in my iTerm2 terminal, and getting a /bin/bash result

You might see zsh or something else, but don’t worry if you want to change it. There are many resources to help you out.

But what should I use?

That’s the great thing, it’s up to you! This is one of those programming things that a lot of people have a lot of opinions on. Frankly, I think start using one, and see what works for you. I have been using bash for years, or at least I think it is years, because I can’t recall when I might have installed it so that probably means it has been a while. If you see something that looks interesting in another shell, try it out for a while! Maybe you will find it does help you in some way. If not, at least now you are more familiar with multiple shells.

Here’s some shell options but let me know, what’s your favorite shell and why?

Discussion (0)

pic
Editor guide