finger should give you last login information and perhaps you could parse this to read the date and compare it with a date you specify? Not easy, but possible I guess. You could try posting for advice in the Unix Scripting forum. Cheers.
listusers |awk '{ print $1 }' > list.txt #(this gives you the list of non-default users on the syste)
cat list.txt | while read LINE
do
finger $LINE >> finger.txt # This runs finger on all the non-default users.
done
awk '/Login/{print;getline;getline;print;}' finger.txt > final.txt # This gives you the login name line, login times (or never logged in).
rm finger.txt
I haven't figured out actually pulling out the names of the folks who haven't logged in in 6 months/1 year.
Thanks for your replies ALL! I eventually found out that there's a file called "loginlog" that lists the username and last login date. Right now I'm not sure if this a product of the application on my box or a UNIX feature but it solved my problem.
The 'last' command gives all login history of all users.
last <username> | head -n1 will give you the last time that a user logged into the system.
One caveat - if the user has not logged in within the last year and the wtmp file has not been reset in that time, you may get a false positive. The last command does not report the year and you might show the user having logged in recently, but it's actually from over a year ago.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.