Solved

Unix system stats

Posted on 2007-12-02
9
469 Views
Last Modified: 2013-12-26
How can I generate an statistic, sorted from lowest to highest, of the 10 users that have logged into the system less times over the last month amongst all the users that have logged into the system in this period of time?? (wow :) )
0
Comment
Question by:axtur
9 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 20393030
Your OS version please?
post the ouput of:
uname -a command

also
man last
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20394692
Hi

try

last | awk '{print $1}' | sort | uniq -c | more
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20394768
Hi,

try

last | grep -v wtmp | awk '{print $1}' | sort | uniq -c | sort > /tmp/u.$$
c=`wc -l < /tmp/u.$$`
c=`expr $c - 1`
tail -$c /tmp/u.$$
0
 

Author Comment

by:axtur
ID: 20397381
I only need 10 results, with that I'm getting more than just 10, any help?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 40

Expert Comment

by:omarfarid
ID: 20400488
last | grep -v wtmp | awk '{print $1}' | sort | uniq -c | sort > /tmp/u.$$
c=`wc -l < /tmp/u.$$`
c=`expr $c - 1`
tail -$c /tmp/u.$$ | head -10
      
0
 
LVL 48

Accepted Solution

by:
Tintin earned 250 total points
ID: 20400722
last | egrep -v "reboot|wtmp" | awk '{print $1}' | sort | uniq -c | sort -n | tail - 10
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 250 total points
ID: 20400776
Hi,

Thank you Tintin :)

Correction:

last | egrep -v "reboot|wtmp" | awk '{print $1}' | sort | uniq -c | sort -n | tail - 10

What about the empty line?

0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20400777
Hi,

Thank you Tintin :)

Correction 2:

last | egrep -v "reboot|wtmp" | awk '{print $1}' | sort | uniq -c | sort -n | tail -10

What about the empty line?

      
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20400903
Hi,

Tintin I am just modifying your solution by head rather tail

last | egrep -v "reboot|wtmp" | awk '{print $1}' | sort | uniq -c | sort -n | head  -10
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now