1821458 Members
3496 Online
109633 Solutions
New Discussion юеВ

/dev/pts - What Is It?

 
SOLVED
Go to solution
Bill Brutzman
Frequent Advisor

/dev/pts - What Is It?

To find out whether a client is using Dynamic Connect or wIntegrate, a friend suggested...

ISINT=`tty | grep -c /dev/pts`
if [ "${ISINT}j" = "1j" ]
then
echo "Terminal session"
else
echo "From wIntegrate

When I run it twice on the same client, I obtain different results. What is /dev/pts ?
7 REPLIES 7
John McWilliams_1
Frequent Advisor

Re: /dev/pts - What Is It?

Hi

/dev/pts is the terminal session that is assigned to a user when logged in. If you do a ps -ef |grep pts you will see all the users and user processes on the system have a pts/XX entry where XX is an alpha numeric character.
Denver Osborn
Honored Contributor

Re: /dev/pts - What Is It?

Your friend suggested looking to see if the login has a terminal or pseudo terminal attached. The tty command is used to get the name of the terminal.

Can you change your test from 'tty|grep -c' to check for the return code instead?

Here's a new test...

tty -s
rc=$?
if [ ${rc} -eq 0 ]; then
echo "Terminal session"
elif [ ${rc} -eq 1 ];then
echo "Not a Terminal"
else
echo "unknown"
fi


Could post more detail about how you're running it when you get different results?

-denver
Bill Brutzman
Frequent Advisor

Re: /dev/pts - What Is It?

So everytime a user logs in, hp-ux unix increments the session ID?

Some of the dates on the files are year 3031.

Why am I unable to open these files with a text editor?
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: /dev/pts - What Is It?

So everytime a user logs in, hp-ux unix increments the session ID?
-----------------------------------------
Not precisely; just as process id's increment up to a limit and are then recycled so too are session id's.

3031 exceeds the 32-bit time representation of most flavors of UNIX but that timestamp should have nothing to do with the ability to open a file. That should be solely a function of the files mode (type + permissions); however, the ability to open a file with a text editor is a bit different still. The effects are very unpredictable when a text editor is used on non textual data and vi was never intended to be used on device files.




If it ain't broke, I can fix that.
Bill Brutzman
Frequent Advisor

Re: /dev/pts - What Is It?

It appears that what I really need is the client's IP address.

What is the Unix-prompt command to obtain the client's IP address.
David Bellamy
Respected Contributor

Re: /dev/pts - What Is It?

who -u
Bill Brutzman
Frequent Advisor

Re: /dev/pts - What Is It?

.