?
Solved

Unix system stats

Posted on 2007-12-02
9
Medium Priority
?
477 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

Author Comment

by:axtur
ID: 20397381
I only need 10 results, with that I'm getting more than just 10, any help?
0
 
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 750 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 750 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.
Suggested Courses

752 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