Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

getMostFrequentUser: get the user with the highest login time on a ma…

…chine
  • Loading branch information...
commit a8f6df5b5c97b7af5443ea1f369668e8cf57a59c 1 parent 122c992
@timsutton authored
View
2  getMostFrequentUser/README.txt
@@ -0,0 +1,2 @@
+This one-liner retrieves the username of the user with longest time logged in, using the
+UNIX ac command.
View
5 getMostFrequentUser/getMostFrequentUser.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+#ac -p | awk 'END {print NR }'
+
+ac -p | awk '!/total/' | sort -rnk 2 | awk '{print $1}' | head -n 1
Please sign in to comment.
Something went wrong with that request. Please try again.