What does the team do tty
? It prints the name of the terminal you are using. TTY stands for Teletype. What is the story behind the team name? This needs more explanation.
Teleprinters from the 1800s
In the 1830s and 1840s, machines known as teleprinters were developed. These machines can send printed messages «over the wire» to remote locations. The messages were typed by the sender on a sort of keyboard. They were printed on paper on the receiving end. They were an evolutionary step in telegraphy, which previously relied on Morse code and similar codes.
Messages were encoded and transmitted, then received, decoded and printed. There were several methods used to encode and decode messages. The most famous and one of the most prolific was patented in 1874 by Émile Baudot, for whom the data rate is named. Its character encoding scheme predates ASCII by 89 years.
Baudot coding eventually became the closest thing to a standard in teleprinter coding, and it was adopted by most manufacturers. Bodo’s original hardware design only had five piano-like keys. The operator had to learn a specific key combination for each letter. As a result, the Baudot coding system was paired with the traditional keyboard layout.
To mark this advance, the machines were called teletypes. This was shortened to teletype and eventually to TTY. So that’s where we get the abbreviation TTY from, but what does telegraphy have to do with it?
ASCII and Telex
When ASCII arrived in 1963, it was adopted by teleprinter manufacturers. Despite the invention and widespread use of the telephone, teleprinters were still gaining momentum.
Telex was a worldwide teleprinter network that allowed written messages to be sent around the world. They were the main means of transmitting written messages in the post-World War II period until the facsimile boom of the 1980s.
Computers have also evolved. They have become able to interact with users in real time and support multiple users. The old batch method of working has become insufficient. People didn’t want to wait 24 hours or longer for their results. Creating stacks of punched cards and waiting for the results was no longer acceptable.
People needed a device that would allow them to enter instructions and send the results back to them. People wanted efficiency.
Teletype repurposed
The teletype was an ideal candidate for an input/output device. After all, it was a device designed to allow messages to be typed, encoded, sent, received, decoded, and printed.
What did the teletype care about if the device on the other end of the connection was not another teletype? As long as it spoke the same coding language and could receive messages and send messages back, the teletype was happy.
And, of course, he used a more or less standard keyboard.
Hardware emulated teletypes
Teletypes became the default means of interacting with the large minicomputers and mainframe computers of the era.
They were eventually replaced by devices that emulated these electromechanical machines using electronics. They had cathode ray tubes (CRTs) instead of paper rolls. They did not jitter when delivering responses from the computer. They allowed hitherto impossible features like moving the cursor around the screen, clearing the screen, highlighting text, etc.
The DEC VT05 was an early example of a virtual teleprinter and the ancestor of the famous DEC VT100. Millions of DEC VT100s have been sold.
Software emulated teletypes
In the Linux desktop environment and other Unix-like operating systems such as macOS, the terminal window and applications such as x-term and Konsole are examples of virtual teletypes. But they are fully emulated by software. They are called pseudo-teletypes. This has been shortened to PTS.
And here comes tty
.
What can tty tell us?
Linux has a pseudo-TTY multiplexer that handles connections to all pseudo-TTYs in the Terminal Window (PTS). The multiplexer is the master and the PTS are the slaves. The multiplexer accesses the kernel through a device file located at /dev/ptmx.
Team tty
will print the filename of the device that your pseudo teleleptic slave uses to communicate with the master. And this is, in fact, the number of your terminal window.
Let’s see what tty
reports for our terminal window:
TTY
The response shows that we are connected to the device file at /dev/pts/0.