Based on my understanding, a tty means a computer terminal/teletype, and that /dev/ttyS1 is the driver for serial port 1/COM1 (or more accurately, a driver for UART chip 1 I suppose).

But I don't understand why the serial port driver is named with a "tty" in it ("/dev/ttyS1"). Was it named like this because historically only a computer terminal/teletype could be connected to a serial port?

  • Welcome to Retrocomputing Stack Exchange. Have you seen the tour?
    – wizzwizz4
    Jun 4, 2017 at 17:36

4 Answers 4


Historically a computer terminal or modem would be the most common device connected to a serial port. Thus, the default file name for the device reflects its most common usage, similarly to /dev/lpN for parallel ports, where "lp" stands for "line printer".

For convenience, the device files corresponding to the (sub)set of serial lines dedicated to user terminals would have the names starting from /dev/tty to simplify writing the startup script activating the getty program, something like

for i in /dev/tty?* ; do
getty $i &

Other (for example, outgoing) serial lines, if any, could be named differently (e. g. /dev/modem for an outgoing line). The UNIX kernel doesn't pay attention to the device file name; what is important are the "major" and "minor" numbers associated with the file system node the file name points to.

  • 1
    lp was traditionally assigned to parallel port, where printers would typically connect. tty was a teletype, which was the common operator's terminal device before screen displays became common.
    – SF.
    Jun 6, 2017 at 13:07
  • @SF. If this is an objection, I don't see what prompted it. I did not use the word "display", I said "terminal". The OP already knew what tty stood for.
    – Leo B.
    Jun 6, 2017 at 15:50
  • yep, misread something...
    – SF.
    Jun 6, 2017 at 16:28

TL;DR: Until Unix v7, if you wanted to be able to use a serial port for terminal logins, it had to have a name starting with "/dev/tty".

At the time the first Unix systems were developed, it was common to use a Teletype as a terminal. Early models of the DEC PDP-11 computer came with a Teletype intended to be used as the console terminal. "tty" is an abbreviation for "Teletype".

Later, use of other kinds of terminals became common but the use of the "/dev/tty" naming convention remained in place, even when the port had some other kind of terminal attached. At that time it was common to use most (or all) of the serial ports on a computer for terminals or modems, and the /dev/tty naming was understood to apply to any character-at-a-time interface that could be used for logins.

Nowadays, serial ports aren't usually used for login terminals but the naming has stuck, especially since you can still use them that way if you want to.

Note that you have always been able to rename the device file anything you like, but for a long time if you wanted to use the terminal for logins it had to have a name starting with "/dev/tty". Starting with Unix 7th Edition, you could enable a port for logins and call it any name you like (and the console terminal got renamed /dev/console), but most people continued to follow the /dev/tty convention for user terminals because it's well-known and the default (leading to fewer questions from your users). In Unix v6, login terminals had to be named /dev/ttyX, where X was any single character (0-9 and a-z could be used, except that by convention '8' was reserved for the console terminal).


As the other answers said, yes, it's because terminals were originally connected to serial ports.

If you have 2 computers with functioning serial ports, at least one of them running a unix-like OS, and a null modem cable to connect them, you can still do this now. On one end, configure ttyS0 as a login port (by editing /etc/inittab or some similar file where the getty commands are), and on the other end run a terminal emulator that knows how to drive a serial port (e.g. minicom, screen, putty). For bonus points, run cu or tip on an existing terminal instead.

If you can't conduct this experiment, you can still observe other remaining effects of the historical close relationship between tty's and serial ports, by looking at all the options available in the stty command. Several of them (speed, parity, number of data bits and stop bits, "local" mode, handling of break signals...) are serial port settings that make no sense on any other kind of tty. But they exist on every tty because historically there was no dividing line between configuring the serial port itself and configuring the driver to understand the terminal on the other end of the serial line, so everything was shoved into the stty tool.

You can run stty -a on any tty that isn't a real serial port, and if you match up all the listed modes to their description in man stty, you'll probably find that it is set to 38400 baud, 8 data bits, no parity, 1 stop bit. These settings are pointless. Attempts to change them will either be rejected or have no effect. On ttyS0, you have to get those settings right or the terminal won't work at all.

Then there's the ^S and ^Q special characters to stop and restart terminal output. They still work, but they're not very helpful unless the terminal is a fairly slow serial device. Mostly ^S just provides a way for people to accidentally freeze their terminals and get confused.

  • 3
    I regularly use ^S and ^Q for their intended purpose within xterm or gnome-terminal windows.
    – Leo B.
    Jun 4, 2017 at 23:39
  • @LeoB.you must have fast hands
    – user5152
    Jun 4, 2017 at 23:43
  • The screen buffer size is configurable. I have it set at 5000 lines. That should be enough for everybody.
    – Leo B.
    Jun 4, 2017 at 23:50

It's a little weirder than that. First and foremost, as @Leo B. says, devices have always been identified by device major and minor numbers. Always remember that.

In the old days, the serial terminals (including things like 20ma current loop terminals like ASR-33 teletypes) were accessed as /dev/tty#. Others have discussed this; it's a historical artifact. Some programs (e.g. old versions of getty) hard-coded this assumption. This enshrined it in history.

There were also commonly /dev/cua# devices, which were serial devices with modem control. Less commonly, /dev/ttyd# and /dev/cul# were modem lines.

Over time, some tty's became aliased to /dev/modem, /dev/console, /dev/mouse and other more mnemonic names.

Then things got really weird, with psuedo-ttys. This was the tty abstraction multiplexed over a single connection, and was used for things like X Windows, System V Streams, MPX/Layer, etc. These show up as /dev/vty#, /dev/pty#, /dev/pt/#, etc. The nice thing is that individual psuedo-ttys still by and large obey the same semantics as the old serial ttys.

As I recall, the /dev/ttyS# convention is actually relatively recent. I think it came along with Xenix, but it may have been one of the SysV/x86 ports. It was a way to recognize IBM PC serial ports, with ttyS0 being DOS COM1, ttyS1 being DOS COM2, etc.

  • 2
    Another part of the puzzle that modern users may be missing is that the fact that device names are allocated by the system is a modern innovation. Historically, installing a device would have involved a manual decision on what name to give it and then setting up a device node on the file system to point to its driver. Therefore, using a name that reflects usage rather than device type is simply a matter of picking an appropriate name while installing the device. Today we use aliases to reflect this, as you point out, but that's only necessary because we use device type based names now.
    – Jules
    Nov 1, 2017 at 6:12
  • @Jules ...where modern means "less than 15 years". udev debuted in 2003. Even devfs was introduced in Linux with version 2.3.46 putting it in early 2000. Before that, it was MAKEDEV pretty much all around.
    – user
    Nov 1, 2017 at 11:57
  • You are making me feel old, @MichaelKjörling. :) Though I guess that is a risk one must take when browsing this part of SE... I actually remember the "wow" feeling when devfs and udev were introduced, respectively.
    – AnoE
    Nov 1, 2017 at 18:36
  • Also, udev is essentially userland software managing it for the "system" (as in the kernel). Devfs was/is a different beast, and not every distributor or administrator found it useful for all scenarios. Nov 2, 2017 at 11:01
  • I may be totally mis-remembering but on at least one system, wasn't the S indicative of using modem-control lines? Something like /dev/tty1 could be used three-wire, but /dev/ttyS1 needed one or more of DTR/DSR/CTS/RTS?
    – TripeHound
    Nov 3, 2017 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.