LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Users on pts/# ? (https://www.linuxquestions.org/questions/linux-newbie-8/users-on-pts-369696/)

Vgui 10-04-2005 10:52 AM

Users on pts/# ?
 
I'm sure this is a commonly known answer, but what exactly is pts/1, pts/2, etc.? I'm wondering as I sometimes use the "who" command, and it gives me a few login names on the pts (normally the user I am logged in with). I've started using rxvt instead of aterm, does that have anything to do with it? Thanks for any help.

MensaWater 10-04-2005 11:44 AM

These are "pseudo-ttys" or for short hand "ptys".

Back in the days of serial connection where you'd have hardwired terminals to serial connections on the server they were called "teletypes" or (real) "ttys" for short. With the advent of networking one still needed a way to relate a terminal session to the established connection. However since this connection was no longer hardwired it wouldn't always be the same. This connection appears on a "pty" now. Note that someone on pts/1 today might be on pts/2 tomorrow if he is the second one to login tomorrow but was first today.

Its just a shorthand way of tracking the connection and is generally used as its input (stdin) and output (stdout) device. It is good for checking processes by a given connection if a user is logged in on two different one. Also it is even good for tracking all the processes for a given session if the user has switched user (done su). Have a look at shell (bash, ksh, csh or other) man pages for a discussion of stdin/stdout and other file descriptors.

Doing "ps -ft pts/#" for a given number will show you all processes for the specified pty.

Also notice that on some processes rather than a tty or pty you'll see a "?" in the tty field of ps -ef. These are processes that are backgrounded so aren't associated with a terminal at all. Their stdout is usually something like a log file or a /dev/null to just not keep it.


All times are GMT -5. The time now is 05:38 AM.