Here are 6 commands which I use to view the users who have logged in recently or are currently logged in to any particular Linux machine
deepak ruchi aman rahul ramandeep
Method 2last: This command searches back through the file /var/log/wtmp (or the file designated by the -f flag) and displays a list of all users logged in (and out) since that file was created. Names of users and tty's can be given, in which case last will show only those entries matching the arguments.
# last -a
deepak pts/3 Tue Oct 16 18:01 - 18:01 (00:00) 10.10.10.30
root pts/2 Tue Oct 16 17:51 still logged in 10.10.10.30
root pts/1 Tue Oct 16 14:29 - 18:03 (03:34) 10.10.10.30
root pts/3 Tue Oct 16 11:10 - 13:11 (02:00) 10.10.10.30
root pts/1 Mon Oct 15 20:30 - 13:21 (16:51) 10.10.10.30
root pts/3 Mon Oct 15 18:02 - 18:37 (00:34) 10.10.10.30
root pts/1 Mon Oct 15 15:23 - 18:34 (03:11) 10.10.10.30
root pts/1 Mon Oct 15 10:45 - 15:22 (04:36) 10.10.10.30
root pts/2 Fri Oct 12 18:34 - 15:53 (3+21:19) :2.0
root pts/1 Fri Oct 12 18:07 - 19:34 (01:27) 10.10.10.30
root pts/0 Fri Oct 12 17:57 still logged in :0.0
root tty1 Fri Oct 12 17:56 still logged in :0
reboot system boot Fri Oct 12 17:44 - 18:03 (4+00:19) 2.6.32-220.el6.i686
Method 3secure file: This file contains the logs of all the attempts made for login to your machine with authentication reports
Method 4finger: If no arguments are specified, finger will print an entry for each user currently logged into the system.
Login Name Tty Idle Login Time Office Office Phone
deepak pts/3 Oct 16 18:01 (10.10.10.30)
root root tty1 4d Oct 12 17:56 (:0)
root root pts/0 6:51 Oct 12 17:57 (:0.0)
root root pts/1 2:08 Oct 16 14:29 (10.10.10.30)
root root pts/2 Oct 16 17:51 (10.10.10.30)
Method 5who: This command shows currently logged in users with time details
# who -u
root tty1 2012-10-12 17:56 old 1960 (:0)
root pts/0 2012-10-12 17:57 06:51 2376 (:0.0)
root pts/1 2012-10-16 14:29 02:09 3094 (10.10.10.30)
root pts/2 2012-10-16 17:51 . 3454 (10.10.10.30)
How to give permission to user to run some commands in Linux
How to track all the successful and failed login attempts by users in Linux
Follow the below links for more tutorials
Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
How to configure Samba 4 Secondary Domain Controller
Understanding Load Average in Linux and when to be worried about it?
How to secure Apache web server in Linux using password (.htaccess)
How to register Red Hat Linux with RHN (Red Hat Network )
Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
15 tips to enhance security of your Linux machine
Why is Linux more secure than windows and any other OS
What is the difference between "su" and "su -" in Linux?
What is swappiness and how do we change its value?
How to log iptables messages in different log file
What are the s and k scripts in the etc rcx.d directories
How to check all the currently running services in Linux
How to auto start service after reboot in Linux
What is virtual memory, paging and swap space?