• Arun Kumar

Shell Script to Check User Logins

Linux shell script allows us to create the script to check for the login details of any user. To achieve this we will be using the last command. The last is a command-line utility that displays information about the last login sessions of the system users.

vi user_login_check.sh
# !/bin/bash

echo "Enter the USER NAME : "
read user
last $user

Here is the sample output of the above script

More ways to use the last command.

  • You can to print only the last ten login sessions

  • You can also use the -p (--present) option to find out who logged into the system on a specific date.


Recent Posts

See All

Oracle 19c Installation on Linux

Oracle 19c adds more features to Oracle database and this article demonstrates Oracle 19c installation on Linux 7. We will be using Oracle Linux 7 and Oracle Database 19.3 softwares for this activity.

Basic Linux Commands

This article describes basic Linux commands that you must know as a system or database administrator. Below commands in Linux help you manage any Linux server fast and smoothly. Linux Command List Che

Linux Firewall with iptables and firewalld

In this article will be covering details regarding iptables and firewalld which helps in Linux firewall management. We will also be looking at how to enable specific ports (1521 for Oracle) inside ipt