XK0-004 · Question #497
Which of the following should a systems administrator use to run the uptime command every ten seconds?
The correct answer is B. watch -n10 uptime. The watch command re-executes a given command at a specified interval in seconds using the -n flag. watch -n10 uptime runs uptime every 10 seconds.
Question
Which of the following should a systems administrator use to run the uptime command every ten seconds?
Options
- Acrontab -n10 uptime
- Bwatch -n10 uptime
- Cuptime -s10
- Dcron -s10 uptime
- Etime -x10 uptime
How the community answered
(61 responses)- B93% (57)
- C2% (1)
- D2% (1)
- E3% (2)
Why each option
The watch command re-executes a given command at a specified interval in seconds using the -n flag. watch -n10 uptime runs uptime every 10 seconds.
crontab does not accept a -n flag for intervals in seconds and cannot schedule sub-minute recurring tasks in this syntax.
watch is a utility that repeatedly runs a command and refreshes the terminal output at a defined interval. The -n10 flag sets the interval to 10 seconds, so watch -n10 uptime executes the uptime command every 10 seconds and displays the refreshed output continuously. This is the standard tool for periodic command execution in an interactive terminal session.
uptime has no -s10 flag for repeating execution; -s on uptime shows the time the system was last booted.
cron is a daemon and does not accept command-line arguments in this form to run a command on a seconds-based interval.
The time command measures execution duration of a single command run and has no -x10 flag for repetition.
Concept tested: watch command for repeated interval command execution
Source: https://man7.org/linux/man-pages/man1/watch.1.html
Topics
Community Discussion
No community discussion yet for this question.