nerdexam
CompTIA

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.

System Management

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)
  • B
    93% (57)
  • C
    2% (1)
  • D
    2% (1)
  • E
    3% (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.

Acrontab -n10 uptime

crontab does not accept a -n flag for intervals in seconds and cannot schedule sub-minute recurring tasks in this syntax.

Bwatch -n10 uptimeCorrect

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.

Cuptime -s10

uptime has no -s10 flag for repeating execution; -s on uptime shows the time the system was last booted.

Dcron -s10 uptime

cron is a daemon and does not accept command-line arguments in this form to run a command on a seconds-based interval.

Etime -x10 uptime

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

#watch command#uptime#command scheduling#monitoring

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice