Sort list of currently logged in users and display one line containing the userid that sorts last? Feels like it should be simple, but I'm having trouble coming up with the code for this.
sample for clarification:
user tty2 user pts/0
Sort the list generated by the who command so that the only line being displayed is the last line sorted.
Instead of the above "list" I just want the list sorted and only have the last "sorted" item displayed so like:
This is assuming that is the last line. The other data such as the date and stuff I expect to be included the above shorthand is just an example.
I imagine the code would start off like this:
who | sort
I hope this is not too confusing of an explanation.
Actually I think I just figured this out.
who | sort | tail -n 1