A system administrator needs to overwrite a 1GB file named report.log with null bytes to ensure its data is unrecoverable before deletion. Which of the following commands is the most efficient and appropriate for this specific task?
The correct command is dd if=/dev/zero of=report.log bs=1M count=1024.
/dev/zero is a special character device that provides an infinite stream of null characters (0x00). Using it as the input file (if) for the dd command is the most efficient way to overwrite the target file (of=report.log) with null bytes as requested.
Using /dev/null is incorrect because it is a special device, often called the 'bit bucket', that discards all data written to it. When used as an input source (if=/dev/null), it immediately returns an End-of-File (EOF), meaning no data would be written to report.log.
Using /dev/random is also incorrect for this specific scenario. While it provides high-quality random data which can be used for secure wiping, the question specifies overwriting with 'null bytes' and emphasizes efficiency. /dev/random is much slower than /dev/zero because it can block waiting for the system to gather enough entropy (environmental noise) to generate true random numbers.
Reversing the input and output files (if=report.log of=/dev/zero) is incorrect. This command would read the contents of report.log and pipe them to /dev/zero, where they would be discarded. The original report.log file would be read but not modified.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of /dev/zero in Linux?
Open an interactive chat with Bash
How is /dev/null different from /dev/zero?
Open an interactive chat with Bash
Why is overwriting with /dev/zero faster than /dev/random?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .