Operating System - Linux
1825780 Members
2254 Online
109687 Solutions
New Discussion

How can I tell which one is my current active terminal session?

 
SOLVED
Go to solution
Ian Derringer
Regular Advisor

How can I tell which one is my current active terminal session?

Hi,
Would someone please tell me how I can tell which is my current terminal seesion (tty), so that I don't kill the wrong session. I am currently runing RHAS 3.0 64-bits Linux.

Thank you very mcuh!
Ian
5 REPLIES 5
Bejoy C Alias
Respected Contributor
Solution

Re: How can I tell which one is my current active terminal session?

u can use 'tty' to get the current login terminal.
then use 'who -u |grep ' to get the current login's pid.
Be Always Joy ......
Gopi Sekar
Honored Contributor

Re: How can I tell which one is my current active terminal session?


use tty command to find out the current tty.

if you use ps without any options then by default you will be presented with the process list which belongs to your tty alone, you can search for your process and kill it.

Hope this helps,
G
Never Never Never Giveup
Stuart Browne
Honored Contributor

Re: How can I tell which one is my current active terminal session?

that'd be a 'ps' without a '-e'. i.e. 'ps -l' will give you a long listing of the current tty..

The 'who am i' might also be useful.

If you want to find child/parent process structures, then the 'pstree' command is your friend, i.d. 'pstree -chp'.
One long-haired git at your service...
renarios
Trusted Contributor

Re: How can I tell which one is my current active terminal session?

Hi Ian,

try ps |grep $$

Cheerio,

Renarios
Nothing is more successfull as failure
Ian Derringer
Regular Advisor

Re: How can I tell which one is my current active terminal session?

This is GREAT!! Thanks so much!!

Ian