Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to kill the tty in unix

Tags:

linux

unix

This is the result of the finger command (Today(Monday) when I (Vidya) logged in)

sekic1083 [6:14am] [/home/vidya] -> finger Name        Tty       Idle   Login Time    Where Felix   pts/0        -       Thu 10:06  sekic2594.rnd.ki.sw. john        pts/1       2d       Fri 15:43 john        *pts/2      2d       Fri 15:43 john      *pts/3       4     Fri 15:44 john      *pts/7       -         Thu 16:25 Vidya      pts/0       -         Mon 06:14 Vidya     *pts/5       -         Mon 06:14 Vidya     *pts/6       -         Tue 10:13 Vidya     *pts/9       -         Wed 05:39 Vidya     *pts/10      -         Wed 10:23 

Under column the Tty pts/0 and pts/5 are the current active terminals.

Apart from those two pts/6, pts/9 and pts/10 are also present and I had logged into these last week. But the idle time for them is showing as "-" (not idle).

How can I kill these 6,9 and 10 terminals?

like image 722
Vidya Sagar Avatar asked Mar 04 '13 06:03

Vidya Sagar


People also ask

How do I get rid of suspended tty output?

Another way to stop output is by pressing CTRL-s. The way to restart stopped output is with CTRL-q - try pressing that now. (Unlike a SCROLL LOCK button, though, if CTRL-q doesn't help, you don't need to undo it.)


1 Answers

You can run:

ps -ft pts/6 -t pts/9 -t pts/10 

This would produce an output similar to:

UID        PID  PPID  C STIME TTY          TIME CMD Vidya      772  2701  0 15:26 pts/6    00:00:00 bash Vidya      773  2701  0 16:26 pts/9    00:00:00 bash Vidya      774  2701  0 17:26 pts/10   00:00:00 bash 

Grab the PID from the result.

Use the PIDs to kill the processes:

kill <PID1> <PID2> <PID3> ... 

For the above example:

kill 772 773 774 

If the process doesn't gracefully terminate, just as a last option you can forcefully kill by sending a SIGKILL

kill -9 <PID> 
like image 95
Tuxdude Avatar answered Sep 19 '22 18:09

Tuxdude