Solved

Unix system stats

Posted on 2007-12-02
9
472 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
auto mounter on solaris 1 59
MaxSpan challenge 9 96
Path of Workbook 3 76
Bash Script to Analyze Oracle Schemas 11 103
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

776 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