LPIC-1 Administrative Tasks Practice Question
An administrator wants to run a shell script every day at 2:00 AM. Which command should be used to edit the user's personal crontab?
⚠ Common exam trap
Many candidates think they can directly edit the crontab file in `/var/spool/cron/` with `vi`, but the LPIC-1 exam expects you to know that only the `crontab` command should be used to safely modify user crontabs to avoid syntax errors and file corruption.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
crontab -e
The correct command to edit a user's personal crontab is `crontab -e`. This invokes the default text editor (as defined by the EDITOR or VISUAL environment variable) on the user's crontab file, ensuring proper syntax validation and locking to prevent concurrent edits. It is the standard and recommended way to modify cron jobs for the current user.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
crontab -l
Why it's wrong here
`crontab -l` only lists the invoking user's existing cron entries to standard output; it opens no editor and writes nothing, so no 2:00 AM job can be created. It is tempting because listing is a genuine crontab operation, and it would be the right choice when auditing or verifying scheduled jobs rather than adding one.
- ✓
crontab -e
Why this is correct
crontab -e opens the invoking user's personal crontab in the default editor, letting the administrator add a 0 2 * * * schedule. It edits only that user's own table, matching the requirement for a personal crontab rather than a system-wide file.
- ✗
at 2:00 AM
Why it's wrong here
at schedules a one-off command at a specified time, so 2:00 AM would run once rather than daily. It is the correct tool for a single deferred job, not for recurring daily execution, which cron handles.
- ✗
vi /var/spool/cron/crontabs/username
Why it's wrong here
Editing the spool file directly bypasses crontab's syntax validation and lock handling, and changes may be overwritten or ignored until cron reloads. It is tempting because the file holds the schedule, but crontab -e is the supported editing interface.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LPIC-1 question from scratch — 402 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LPIC-1 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-1 exam.