LFCS Essential Commands Practice Question
A DevOps engineer wants to measure how long a specific command takes to execute. Which command should be used?
⚠ Common exam trap
Candidates often confuse `time` with `date` or `uptime` because they all display time-related information, but only `time` measures the execution duration of a specific command.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
time
The `time` command is specifically designed to measure the execution duration of a command, reporting real time, user CPU time, and system CPU time. It wraps the target command and tracks the elapsed wall-clock time and resource usage, making it the precise tool for benchmarking command performance.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
date
Why it's wrong here
date prints the current system clock, so subtracting two invocations requires manual arithmetic and cannot capture a command's duration directly. It is tempting because timestamps bracket execution, but the shell's time keyword or /usr/bin/time reports elapsed, user and system time automatically.
- ✗
uptime
Why it's wrong here
uptime reports how long the system has been running plus load averages, which says nothing about a single command's execution duration. It is tempting because it displays a time figure, but that figure is host uptime, not the elapsed interval of the process you want to measure.
- ✗
wall
Why it's wrong here
wall broadcasts a message to all logged-in terminals; it performs no timing measurement whatsoever. It is tempting only because it is a shell command beginning with a familiar letter, but it writes to tty sessions rather than recording start and end times for a process.
- ✓
time
Why this is correct
The time shell keyword reports real, user and system execution durations for the following command, directly measuring elapsed runtime. Other tools such as date only bracket execution manually, and strace traces syscalls rather than timing the whole command.
Go deeper
Related to this question
About these practice questions
One of 406 original LFCS practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.