Check the time elapsed since boot.
Also show logged-in users and the 1-, 5-, and 15-minute load averages.
Which command is correct?
uptime prints the current time, elapsed uptime, number of users, and the three standard load averages.
Detailed explanation
uptimeCorrect. uptime reports all of the requested values in one line.
Correct. uptime reports all of the requested values in one line.
freeIncorrect. free reports memory and swap statistics.
Incorrect. free reports memory and swap statistics.
jobsIncorrect. jobs reports shell jobs only.
Incorrect. jobs reports shell jobs only.
pgrepIncorrect. pgrep searches processes rather than showing system uptime and load.
Incorrect. pgrep searches processes rather than showing system uptime and load.
Try it yourself
An example you can run in a temporary verification environment.
uptimeExpected result
up、user、load averageを含む1行(値は環境により変動)Key points
- Uptime duration
- Three load-average periods
- Different from memory statistics
Notes
- Environment: procps-ng 4.x
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.