An Introduction to Your Terminal

All developers will use a terminal at some point, if not every day. So it's important to understand how it works, how to use it, and how to get the most out of it.

The efficient use of the terminal can be a programmer's secret weapon.

Table of Contents

Introduction to the Terminal

You're probably used to using computers with a nice display and graphical user interfaces for most programs.

But not all computers have displays, in fact, most don't.

The terminal lets you use a computer through text input and output instead of a graphical interface.

This is usually how you interact with servers and remote devices that don't have a GUI.

Let's define a few important terms we'll need for the rest of this article.

Terminal: An interface between a keyboard and monitor. Learn more.

Terminal emulator: (TTY) Emulates a terminal, providing input and output.

Pseudo-Terminal: (PTY) A piece of software like ssh or a GUI terminal provide a terminal-like interface through a separate piece of software. Learn more.

Shell: A command line interpreter that interprets the input you feed your terminal. Popular shells are bash and zsh.

Emulators

If you're using on MacOS or Linux, your machine will come with a program called "Terminal" installed.

But many developers prefer to install different terminal emulators of their choice.

MacOS

For MacOS, the most popular and my personal favorite is iTerm2. It comes with tons of additional functionality such as split panes, easy tab navigation, and awesome color support.

On Linux, you have a different set of terminal emulators available to you like Terminator and Tillix.

Shells

Your shell is your command line interpreter. There are many shells to choose from but most of them are quite similar.

Also, you can run your preferred shell in any terminal emulator.

Popular Shells include bash, zsh, and fish.

Bash

The oldest shell on this list is Bash.

It's great because it is supported by default on almost all machines.

If you ever ssh into another machine you can assume it's already using Bash.

Zsh

An extended version of the Bourne Shell with newer features and support for plugins. Since it's based on the same shell as Bash, it uses most of the same commands and can be an easy switch for anyone using Bash.

It now comes as the default shell on MacOS, but may not be the default shell when you ssh into other and older machines.

Official website here.

Fish

An even newer shell with even more features. Official Fish website

Using Commands

Your terminal is a text-based interface to the internal workings of your machine. This means you tell it what to do and it obeys! The Command-Line Interface!

The Unix/Linux systems come with standard commands out of the box. You can install additional software and add commands yourself too. The default commands available to you will depend on the shell you are using. The oldest of the listed, and most widely supported is Bash which has some commands you will likely use all the time.

Beginner terminal users should learn at least these commands:

  • cd - Change Directory
  • ls
  • mkdir - Make Directory
    • Usage: mkdir <directory name>
    • Creates an empty directory with the given name in your current working directory.
  • touch
    • Usage: touch <filename>
    • Creates an empty file with the given name in your current working directory.
  • man - Manual
    • Usage: man <other_command>
    • Returns a manual of how to use the given command! Try it on any command you don't understand. It also gives you all of the flags and modifiers you can add to a command.

Advanced users, I have a command dictionary coming out soon!

Customization

Most terminal emulators allow a good amount of customization. Most shells do as well. This can be a fun process every developer should experience to learn more about how their terminal and shell work. It's also a tool you will look at and use often so it makes sense to optimize the look, feel, and experience!

Some customizations we'll get into soon. Feel free to look these up on your own!

  • aliases
  • colors
  • custom shell profiles

Style

Coming soon!

Shell Scripting

scripting automation tricks tips. Coming soon!

Final Words

By now you should be a terminal expert!

Or at least you hopefully have a much better understanding of how it works. It's a very powerful tool that you have at your disposal that is in my opinion very underused.

You can follow me on Twitter if you want to talk terminals some more!

Featured
Level up faster
Recommended Books
Check out my list.
One on Ones: 101
Leveraging Other People's Experience
Hey, I'm Nicholas Dill.

I help people become better software developers with daily tips, tricks, and advice.

Level up
Related Articles
More like this
How to use Grep to Search in the Terminal