Let's say that we have a PDP-11 computer with Unix installed on it and we have three terminals connected to it:

PDP11 with 3 terminals

A terminal can use the tty Unix command to get the terminal number.

Now my question is: is the terminal number fixed? that is, if Terminal 2 typed the tty command, and the returned result was /dev/tty1, will the terminal number always be /dev/tty1, or will it change if the terminal was rebooted or something?

  • 4
    It was fixed in the configuration file. TTY1 would be on a specific port of the PDP.
    – Chenmunka
    Apr 20, 2017 at 11:49
  • @Chenmunka What is the "configuration file"? Apr 20, 2017 at 12:45
  • That's why I commented, not answered. When I get a chance to look it up, I'll post an answer. Unless someone beats me to it.
    – Chenmunka
    Apr 20, 2017 at 13:03
  • The configuration file is actually /etc/ttys that holds a line for each terminal, its type and the physical port it is connected to.
    – tofro
    Nov 6, 2020 at 13:11

2 Answers 2


The tty command doesn't really tell you which terminal you're using, rather it tells you which terminal port on the PDP-11 you're using. So restarting your terminal won't change what tty outputs, but swapping cables with an adjacent terminal would (or alternatively, swapping which ports the terminal cables connect to).

You can change the name of the port by renaming the appropriate special file in the /dev directory. If you do this you will also need to update the /etc/ttys file which lists the names of the ports that users may use for logins.

Note that pseudo-terminal (pty) names are not fixed, because you will get assigned a pty from a pool of available ptys when you connect. So if you connect to the system over the network using telnet, you might be assigned ttyp0, or ttyp1, or ttyp2, etc., depending on which ones are in use already. But if you're the only person who uses the computer then you can be pretty sure you will always end up being assigned ttyp0.


These were actual serial terminals, and the tty device file very likely corresponded to a serial card - and it is likely that the kernel either had a compiled-in idea on which I/O addresses which serial card would be expected, or there even was a kernel build-time configuration mechanism to configure how many terminals you had at maximum, and where the serial ports were in I/O space...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .