Solved

Unix system stats

Posted on 2007-12-02
9
473 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
EvenOdd challenge 10 125
Expand a partition in Centos 7 Linux with Virtualmin 1 68
how to split multiple lines delimiter : 8 109
Not needed 13 119
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.

808 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