Question: The who command lists all users that are currently logged in to the computer, as well as (among other things) when the user logged in.

The who command lists all users that are currently logged in to the computer, as well as (among other things) when the user logged in.

Provide a command line, using pipes, that provides, as its only output, the name of the user that has been logged in for the longest in the computer, according to the output of who (called without arguments). Here are a few other commands that may be useful:

  • The sort command includes options to sort based on a different field of the output, rather than from the start. Note that whoprovides the login time with year first, which simplifies string-based comparison in sort.
  • Commands like awk and sed can be used to parse and retrieve only part of the provided information (e.g., only one column of a specific line). Alternatively, a combination of commands like cut and head can be used to provide this functionality.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!