Sponsored Content
Top Forums UNIX for Dummies Questions & Answers is there a command to see when the last time a user has been online if they arent? Post 302590508 by subway69 on Monday 16th of January 2012 01:34:33 PM
Old 01-16-2012
Quote:
Originally Posted by pandeesh
if you want to filter out the last time alone then use:
Code:
last |head -1

Code:
pandeeswaran@ubuntu:~$ last |head -1
pandeesw pts/0        :0               Mon Jan 16 13:13   still logged in

thank you

im writing a script that displays the last time the user has been on and a quick question here

Currently it displays the last time the user has been on but multiple times, will using head -1 limit it to one? I have tried head -1 and it returns nothing in the script

Code:
 last | grep $1 | awk '{print $1 "is not online and last logged in" $5 "" $6 "" $9"" $10}'

the $1 is the input from the user
 

5 More Discussions You Might Find Interesting

1. Programming

checking the heartbeat of the online user

hello, Can anyone please tell me how can i check the availability of the online user in a client-server environtment. This is for a program where lakhs of client are connected to the server and the server has to check the availability of the every client in every minute. So polling every client... (0 Replies)
Discussion started by: shushilmore
0 Replies

2. Shell Programming and Scripting

Online user list script

I decided to delete the first post since it was againt the forum rules (4 Replies)
Discussion started by: Necrologist
4 Replies

3. UNIX for Advanced & Expert Users

time duration of being online of a particular user given the user name

in a multi user system of 3 users X,Y,Z, if i know that X is presently online, is it possible to determine for how long has he been online? i mean the time duration (3 Replies)
Discussion started by: arindamlive
3 Replies

4. Shell Programming and Scripting

History of all the users in single file with command , date . time , ip and user

HTML Code archive_history() { HISTORYOLD=${HISTFILE}.archive CURTIME=`date` CURTTY=`tty` IP=$(echo $SSH_CLIENT | awk '{print $1}') if ; then echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >> $HISTORYOLD history... (2 Replies)
Discussion started by: rehantayyab82
2 Replies

5. Shell Programming and Scripting

History of all the users in single file with command , date . time , ip and user

HTML Code: archive_history() { HISTORYOLD=${HISTFILE}.archive CURTIME=`date` CURTTY=`tty` IP=$(echo $SSH_CLIENT | awk '{print $1}') if ; then echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >> $HISTORYOLD history... (0 Replies)
Discussion started by: rehantayyab82
0 Replies
All times are GMT -4. The time now is 11:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy