How to Schedule a One-Time Script with at in Linux (XK0-005)?
A Linux administrator would like to run the cleanup script /home/admin/script.sh at 9:00 p.m. on March 31. Which of the following commands should the administrator use to accomplish this task?
Community Votes
72% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
This question tests your ability to use the
atcommand's-foption correctly; the common trap is placing-fafter the time or confusing stdin redirection with reading a file.
In the Linux+ XK0-005 exam, scheduling a one-time script with at requires the -f option. Community testing shows at -f /home/admin/script.sh 9pm March 31 is the reliable command.
Option D (`at 9pm March 31 -f ...`) is the most popular wrong choice because many Linux versions allow options after arguments, but the exam and GNU at documentation expect `-f file` before the time.
Community Discussion (5 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option A is the standard syntax for theat command: at -f /home/admin/script.sh 9pm March 31. The -f flag tells at to read job commands from the named file, and the time/date specifier follows directly. Comment [1] confirms they tested all four commands and only A produced output, proving it executes successfully. The at man page also lists -f file as the way to run a script without typing it interactively.Why the Other Options Are Wrong
Option B fails becauseecho < file | at pipes empty output to at — echo does not read stdin, so the cleanup script is never submitted. Option C is even worse: it pipes at's output into echo > script.sh, attempting to write to the script file and corrupting or truncating it. Option D is a syntax gray area; some modern at builds accept -f after the time, but the official usage and the CompTIA exam favor A, and comment [1] observed D did not work in their one-liner test.Community Comment Notes
Comment [1] provides valuable hands-on evidence: all four commands were tested, and only A ran the script correctly. Comment [4] incorrectly argues A and D are invalid flags, but the man page proves-f is valid; comment [3] cites Baeldung showing at -f file time, reinforcing A. Treat D as a distractor because the exam expects the canonical option ordering. Official Reference
Exam Strategy
For at questions, write the command as at -f <file> <time> and avoid piping or reordering flags. If you're unsure, check the order: the -f option belongs immediately after at before the time.
at 9pm March 31and it puts you at the at> prompt. Adding the remainer of the commands did not result in any output to the text file