Saturday 28 January 2012

finger


f, finger
f or finger command  shows   the details of  the users  who  are currently logged in a machine.
It is useful in a work  environment where lot of users are  logged into a server and as an administrator of various modules, it becomes necessary to monitor who is doing what.

Example 1) To display all the users who are logged into
 a system simply enter f or finger.
/home/oracle-admin$  finger
<-----------------------------[Samudra]                                             Name Of Server
 Login       Name                TTY        Idle                When                   Site Info 
 W3679     Anand              pts1          2d                 Jun   20  14:27          
 S2865       Sahana            pts3           11:              Jun  20  13:25           
 B867         Sheldon           pts2           3                 Jun  19  19:01         


Example 2)
If   you are using a session  already open by someone and  you do not know whose session is it,
You can use  the ‘who’ or ‘who am i’ command to know the details of the user.

But  there might be a scenario where the  user has logged in by his username and working as
some other  by using ‘su’ command, and you want to know the base user name instantly.
Use finger along with ‘who am I’ as follows


/home/oracle-admin $ echo "`finger `"|grep "`who am i | awk '{print $1}'`" | awk '{print "I AM "$2}'|head -1
I AM Akash

This command might sound too complex and lengthy ,but is helpful in unix work environments.
Save this command as  a script and run it everytime you need to know the detail.


The names of users are saved in /etc/passwd file and displayed as  such. You cannot  change the values  in the file directly unless you are a root user.
To modify your name use  passwd command.

No comments:

Post a Comment