How to Schedule a One-Time Script with at in Linux (XK0-005)?
Short answer
A at –f /home/admin/script.sh 9pm March 31
Question
Key Takeaways
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.
Common mistake: 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.
Expert Analysis
Why the Answer Is Correct
Option A is the standard syntax for the at 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 because echo < 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
https://www.baeldung.com/linux/at-command
This link opens the official vendor documentation in a new tab.
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.
Community Votes
72% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 5 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 5
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
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