Page 1 of 1

UNIX Terminals & TTYs

Posted: Tue Nov 23, 2010 4:21 pm
by iocoder
Hello All!
While i was reading about the history of Computers and UNIX, a lot of questions came to my mind and i am really curious to have answers to them.

What i have understanded is that a terminal is a device which is connected to the computer. it has a typewriter and a small screen for Input/Output operations between the user and the system.

To log in UNIX, call "UNIX" from an appropriate terminal, the messege "LOGIN:" is sent to the output screen by the kernel of UNIX. then you type your username and press "RETURN" key from the typewriter. then, in the same way, you send your password and telephone number.

After a successful log in, the shell program is executed, and "%" is outputted. the shell waits until you enter a command and press return.

My Questions:

1- What is the difference between the terminal and TTY (Tele-Type Writer)?
2- How size is the output screen of the terminal?
3- Is the terminal able to print out papers such as any typewriter machine?
4- What exactly is the phone number that may be required to log in?
5- the cat command, what is the real use of it?

Waiting for an answer.
Great thanks and Regards,
Mostafa

Re: UNIX Terminals & TTYs

Posted: Tue Nov 23, 2010 8:34 pm
by bewing
Heh. You are looking at some very very old unix stuff.
1- What is the difference between the terminal and TTY (Tele-Type Writer)?
2- How size is the output screen of the terminal?
3- Is the terminal able to print out papers such as any typewriter machine?
4- What exactly is the phone number that may be required to log in?
5- the cat command, what is the real use of it?
1) It depends on how you use the terms. The way most people mean them, they are the same thing. "Terminal" always means hardware. "tty" can mean the software drivers, or a virtual device (like /dev/null). "tty" can also mean "any character-special device" -- that is, anything that is not a disk file, or a block-special driver.

2) Almost all terminals were 24 lines x 80 characters. Some had special modes that you could activate -- typically to either access a 25th "status line" at the bottom or top of the screen, or to enable 24 lines x 132 column mode.

3) No. We are mostly talking about things like the DEC VT100. A keyboard connected to a monochrome video display. But a punch card machine for input, and a printer for 'display' was an acceptable replacement.

4) That was only one very specific login program. There were many login programs, and almost none of them did that. For the ones that did, it was mostly just for one extra security check.

5) What is the purpose of the "type" command in DOS? Cat dumps a file to your screen, with no modification. You can redirect the output to a printer, and then you've printed the file. You can redirect the output to another file, and then you've copied the file. You can 'cat' multiple files with one command (which appends them all together) and then store them. Programs that do such general-purpose things as cat are very very important when you are trying to create 'shell script' programs (known as 'batch' files in DOS). There are many 'scripting languages' around today, and they probably still use cat.

Re: UNIX Terminals & TTYs

Posted: Wed Nov 24, 2010 2:06 am
by Solar
I would like to extend some of bewing's statements.

First, I want to second his statement that you are looking at some ancient documentation there. Beware, many things have changed significantly since that was written!

As for your questions:

2) Yes, 80x24 or 80x25 was somewhat of a standard. Because the remote machine could not really know, a protocol was established that allowed the remote machine to query for the capabilities of the terminal. Google for "termcap".

5) Actually, the default action of 'cat' is to pipe standard input to standard output, but that is not very useful so 'cat' is usually given a filename to use for standard input. The usefulness becomes clear when you have a tool that does useful things, let's call it 'xyztool', but which does these things only to its standard input, and cannot accept a file name to process that. 'cat <filename> | xyztool' is the way to do it in this case.

Re: UNIX Terminals & TTYs

Posted: Wed Nov 24, 2010 2:31 am
by Owen
On most Unixes and Unixlikes, at startup the program /sbin/getty will be run with its input connected to the system's TTYs. getty will then start /sbin/login, which is the default interactive login program. login will then normally do credential requests and forward the results to PAM.

I've never met a system which asks for a phone number; that seems like it would be rather ancient.

Re: UNIX Terminals & TTYs

Posted: Wed Nov 24, 2010 8:45 am
by fronty
bewing wrote:You can 'cat' multiple files with one command (which appends them all together)
Or maybe we could even say, "conCATenates".

Re: UNIX Terminals & TTYs

Posted: Wed Nov 24, 2010 9:21 am
by bewing
When talking to non-English speakers, it is good to remember that "append" is a very well-known word. Concatenate is not. :wink:

Re: UNIX Terminals & TTYs

Posted: Wed Nov 24, 2010 9:38 am
by fronty
Okay, that may be true.

Re: UNIX Terminals & TTYs

Posted: Thu Nov 25, 2010 2:55 pm
by Brynet-Inc
For real Unix systems, input was done exclusively over serial tty's.. the connected device could be a wide variety of terminal design, but originally only a paper typewriter (..before video displays were readily available).

The kernel on modern Unix systems simulates a terminal using the keyboard and monitor, it emulates some existing "real" terminal that once existed and were common.. like the vt100/vt220.

Many Unix-like systems still support real serial terminals, but it probably could be added trivially to the ones that don't.

GUI environments running on a Unix-like system often have a terminal emulator available.. on most systems a pseudo-terminal pair is used (..sometimes dynamically created), again, this emulator behaves not unlike a physically connected terminal.

I'm not going to answer all of your rather vauge questions, but others may have provided some helpful insight.