LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-09-2019, 02:28 PM   #1
kbbeard51
LQ Newbie
 
Registered: Feb 2016
Posts: 1

Rep: Reputation: Disabled
script to count the number of times three users have logged into the servers


I'm writing a script to count the number of times three users have logged into the servers. Where do I start (in BASH).
 
Old 07-09-2019, 02:41 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by kbbeard51 View Post
I'm writing a script to count the number of times three users have logged into the servers. Where do I start (in BASH).
Welcome to LQ.

The first line of the script where it says:
Code:
#/bin/bash
Next, please read the My Bash Blog link from my signature which describes some techniques for writing bash scripts, as well as offers other bash references.
 
1 members found this post helpful.
Old 07-09-2019, 02:51 PM   #3
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
who will tell you who is logged on. See: man who
You don't say if you are using systemd. If so journalctl will you some info on that like sudo. Then there is /var/log/auth.log

https://stackoverflow.com/questions/...logouts-script

To get the last logins of kbbeard51
Code:
last kbbeard51
Or you can run last to see all.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing the number of times logged into Linux to a file /Mos_Damerad_VII Red Hat 2 03-17-2017 06:00 AM
bash script to count number of times a command is found in history file Mike0 Programming 3 04-28-2015 06:43 AM
[SOLVED] linux functions, from time to time giving series of three beeps, repeated three times Yury_T Linux - General 7 11-19-2014 01:27 PM
IPs logged as D.C.B.A and some times A.B.C.D how to find which format is logged tkmsr Linux - Security 15 11-18-2010 08:29 AM
iptables and limiting the number of times an event gets logged drexel Linux - Security 3 02-09-2004 08:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration