DEV Community

Cover image for 10 things you didn't know about the terminal
Michael Hausenblas for AWS

Posted on

10 things you didn't know about the terminal

1. Why still 80 characters default

We regularly use monitors that have a gazillion of pixels available and yet, the default terminal width is 80 characters. Why, oh why?

TL;DR: we owe this one to IBM and their standardized punchcards, introduced in the 1920s, sporting 80 columns:

Used Punchcard (5151286161)

2. Terminal: not the same as the shell or CLI

Terminal. Shell. Command Line Interface (CLI). Three distinct and different things. Very much related, but they are and do different things: terminal is that window that may host a shell as well as other programs using a textual interface. CLIs are line-oriented, textual interfaces and come in all forms and shapes, for example the aws CLI or when you are looking for something (aka: Google search). Learn more about the differences from this Q&A piece.

3. It's literally the end

The word terminal comes from Latin "terminus", meaning "an end, a limit, boundary line". Not too surprising: from where the mainframe sits, the people working on computer terminals are indeed the end of the communication line.

4. Not the real thing? Emulator much!

Unless you're in a museum, you're not really using a terminal these days. What you're using is a program called a terminal emulator, rather directly emulating a good old video or computer terminal from the 70s. Nice!

5. Tame the beast

Since the terminal emulator is a piece of software, one would expect to be able to configure it to their liking. And indeed there are a number of things you can learn from your terminal's configuration and even set some. Here's what I see when I look at mine (Alacritty on macOS; edited down to only show the beginning):

$ infocmp -L -1                                                                                                                                                                                                                                     
# Reconstructed via infocmp from file: /usr/share/terminfo/73/screen-256color
screen-256color|GNU Screen with 256 colors,
        auto_right_margin,
        backspaces_with_bs,
        eat_newline_glitch,
        has_hardware_tabs,
        has_meta_key,
        move_insert_mode,
        move_standout_mode,
        columns#80,
...
Enter fullscreen mode Exit fullscreen mode

6. Why vi and YouTube use j and l?

Ever used vi and wondered why pressing the j key sends you a line down? Or, likewise, when you're watching a YouTube video and you want to fast-forward some 10 sec by hitting the l key?

Peter has the answer:

When Bill Joy created the vi text editor he used the ADM-3A terminal, which had the arrows on hjkl keys. Naturally he reused the same keys and the rest is history.

So, we can thank Bill Joy's terminal or more specifically its builtin keyboard layout.

7. One terminal is not enough!

As the title suggests and your monitor confirms: one terminal is not enough. Sure, you can launch multiple terminal windows or use tabs or whatever is kewl these days. We elderly people use terminal multiplexer such as tmux (preferred) or screen (if you're really, really old).

8. GPU here I come

You have a GPU I'm sure and you don't know how to keep its cache lines warm? Here's a suggestion: ditch your old terminal and give one of the GPU-powered terminals a try. I've personally migrated from iTerm2 to alacritty and have only good things to say about it (moar YAML for config, yay) but there are also other options like kitty. Might take you a day or so to move over but totally worth it, if you spend more than 50% of your time in the terminal ;)

9. Terminal vs. tty

Remember when we talked about software terminals in 4., above? I didn't really tell you the whole truth back then. Now that you're a terminal expert: meet tty which is short for “teletypewriter.” Learn more about What is a TTY on Linux? (and How to Use the tty Command) and thank me later.

10. Terminal vs stdin, stdout, and stderr

In the context of the shell and from programming languages you've almost certainly come across terms like stdin or stdout. Turns out those are simply per-process fixed files (with well-known file descriptors) that you're using to interact with, in the case of stdout … wait for it … your terminal! Read more in Your terminal is not a terminal: An Introduction to Streams.

With that, thanks for stopping by and I'm wondering: what's your favorite thing about the terminal that few people know? Care to share?


Cover image kudos to AT&T Archives, depicting Brian Kernighan rocking an early terminal.

Top comments (2)

Collapse
 
jameson profile image
Jameson
Collapse
 
dtuite profile image
David Tuite

Great article Michael and a good history lesson too!