0

How to list out i"dle users only" using finger command? (Commandline)

$finger
Login      Name                  Tty      Idle  Login Time   Where
ravikumar  ravikumar            *:0      -         Sun 19:54 console
ravikumar  ravikumar            *pts/0    2:36     Sun 19:56 
ravikumar  ravikumar            *pts/1   -         Sun 22:08 
$ finger | tr -s " " | sort -k 4 
ravikumar ravikumar *pts/0 2:47 Sun 19:56 
Login Name Tty Idle Login Time Where
ravikumar ravikumar *:0 - Sun 19:54 console
ravikumar ravikumar *pts/1 - Sun 22:08

In the above usage how to get the number of idle users,
so that I can pipe with head command?

Opensuse uses '-' to represent idle state, suppose if Blank space is used
to indicate idle state Means, How to select the idle users, since "tr -s" is useless?

Edited by b1izzard: n/a

3
Contributors
5
Replies
7
Views
5 Years
Discussion Span
Last Post by b1izzard
0

Bear in mind that console windows or tabs in the UI are represented by the *pts/0...n devices. In this case, ravikumar is logged in on the console and has two virtual terminals open, one of which has been idle for some time. I also keep a number of virtual terminals open on my system, each for different purposes, so in my case I have a couple with no idle time, and 2 with 5 day idle times. They don't take much memory or other resources, so it is usually best to leave them alone. Remote logins are another issue, and those are what you need to look for because they do take up network bandwidth just to keep the connection alive.

0

Bear in mind that console windows or tabs in the UI are represented by the *pts/0...n devices. In this case, ravikumar is logged in on the console and has two virtual terminals open, one of which has been idle for some time. I also keep a number of virtual terminals open on my system, each for different purposes, so in my case I have a couple with no idle time, and 2 with 5 day idle times. They don't take much memory or other resources, so it is usually best to leave them alone. Remote logins are another issue, and those are what you need to look for because they do take up network bandwidth just to keep the connection alive.

Thanks for the Info. I just want to give an example. Actually I need to find out Idle users in our lab environment where we use PUTTY to connect to the server.

0

Thanks for the Info. I just want to give an example. Actually I need to find out Idle users in our lab environment where we use PUTTY to connect to the server.

That makes sense, and is the most common use for terminating idle connections. You also might want to check into the "who" command instead of finger. It will provide a lot of useful information, including old connections if you use the "-a" option. Anyway, read the man page.

0

who -Tu | awk '$7 !~ /\./ {print $1 , $8}' | sort -u

Thank you voidyman :cool:,

$who -Tu | tr -s " " | cut -d " " -f1,6 | grep "[^a-z?. ]"

How about this?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.