954,228 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to find Out Idle users only using finger command?

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?

ravi89
Junior Poster
114 posts since Jun 2009
Reputation Points: 11
Solved Threads: 13
 

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.

rubberman
Posting Virtuoso
1,559 posts since Mar 2010
Reputation Points: 277
Solved Threads: 178
 
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.

ravi89
Junior Poster
114 posts since Jun 2009
Reputation Points: 11
Solved Threads: 13
 
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.

rubberman
Posting Virtuoso
1,559 posts since Mar 2010
Reputation Points: 277
Solved Threads: 178
 

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

voidyman
Newbie Poster
17 posts since Sep 2011
Reputation Points: 10
Solved Threads: 1
 
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?

ravi89
Junior Poster
114 posts since Jun 2009
Reputation Points: 11
Solved Threads: 13
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: