Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the default terminal width 80 characters?

80 seems to be the default in many different environments and I'm looking for a technical or historical reason. It is common knowledge that lines of code shouldn't exceed 80 characters, but I'm hard pressed to find a reason why outside of "some people might get annoyed."

like image 636
num1 Avatar asked Jan 10 '11 20:01

num1


People also ask

Why is an 80 line length?

You would write your program out in long hand, in paper, and then you would punch it into the cards. And so if you went over 80 characters, you were dead. There was no more lines on the punch-cards.

Why lines shouldn't be longer than 80 columns wide?

Lines that are 80 characters long may cause wrapping when the file is dumped to an 80 column terminal unless the terminal is set to truncate long lines. In some terminals, under some configuration, when a character is printed in the 80th position, the cursor then advances to the start of the next line.

How many characters wide is a terminal?

IDEA-260785 Integrated Terminal not handling shell features well. IDEA-261136 builtin terminal shows multiple issues with zsh npm-check, etc. WI-58435 Terminal seems to think it is at default size 80x24, completely broken and unusable.

What is standard terminal width?

Many terminals allow configuration of a default size. The “normal” size for a terminal is 80 columns by 24 rows. These dimensions were inherited from the size of common hardware terminals, which, in turn, were influenced by the format of IBM punch cards (80 columns by 12 rows).


2 Answers

As per Wikipedia:

80 chars per line is historically descended from punched cards and later broadly used in monitor text mode

source: http://en.wikipedia.org/wiki/Characters_per_line

Shall I still use 80 CPL?

Many developers argue to use 80 CPL even if you could use more. Quoting from: http://richarddingwall.name/2008/05/31/is-the-80-character-line-limit-still-relevant/

Long lines that span too far across the monitor are hard to read. This is typography 101. The shorter your line lengths, the less your eye has to travel to see it.

If your code is narrow enough, you can fit two files on screen, side by side, at the same time. This can be very useful if you’re comparing files, or watching your application run side-by-side with a debugger in real time.

Plus, if you write code 80 columns wide, you can relax knowing that your code will be readable and maintainable on more-or-less any computer in the world.

Another nice side effect is that snippets of narrow code are much easier to embed into documents or blog posts.

As a Vim user, I keep ColorColumn=80 in my ~/.vimrc. If I remember correctly, Eclipse autoformat CtrlShiftF, breaks lines at 80 chars by default.

Vim with ColorColumn enabled. Right-Click > Open Image in new tab for larger image

like image 194
Nishant Avatar answered Oct 12 '22 10:10

Nishant


It is because IBM punch cards were 80 characters wide.

like image 31
erickson Avatar answered Oct 12 '22 09:10

erickson