LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   question on pts and pty (https://www.linuxquestions.org/questions/linux-newbie-8/question-on-pts-and-pty-4175528220/)

sryzdn 12-14-2014 03:41 AM

question on pts and pty
 
Hi,

Looking at man pages of pts and pty it says:

Quote:

pty: pseudoteletype
Quote:

pts: pseudo terminal slave
It seems that they both deal with master slave channels. But, pts refers to /dev/ptmx which is a device file. What is really their difference? Could you please give me a simple clarification on these terms?

smallpond 12-14-2014 06:58 AM

In early Unix systems the computer console was just lights and switches. If you wanted a keyboard and display (no mice then) you connected a terminal using a serial port. Those are long gone, but a lot of software still exists that expects to talk to a terminal. The master and slave you mention just emulate the two ends of that connection. When you open a bash window, the ps command shows a pts/0 which is the terminal end of the emulated serial connection. If you actually have a terminal it would be ttyS0. Opening ptmx is what creates a new pts when you start the terminal window. That saves you from having 256 pts in your dev directory and then having to search for a free one when you want to make a connection.


All times are GMT -5. The time now is 09:21 AM.