Bird
0
0

You want to create a script that runs top for 10 seconds, saves the output to a file, and then exits. Which command achieves this?

hard📝 Application Q9 of 15
Linux CLI - Process Management
You want to create a script that runs top for 10 seconds, saves the output to a file, and then exits. Which command achieves this?
Atop --time=10 > top_output.txt
Btop -d 10 > top_output.txt
Chtop -t 10 > top_output.txt
Dtop -b -n 10 > top_output.txt
Step-by-Step Solution
Solution:
  1. Step 1: Understand top options for batch mode and iterations

    top -b runs in batch mode (non-interactive), -n 10 runs 10 iterations, then exits.
  2. Step 2: Check other options

    -d sets delay between updates, not total time; htop does not support -t; --time is invalid option.
  3. Final Answer:

    top -b -n 10 > top_output.txt -> Option D
  4. Quick Check:

    Batch mode + iterations = top -b -n [OK]
Quick Trick: Use top -b -n for batch output to file [OK]
Common Mistakes:
  • Using invalid options like --time
  • Confusing delay with total run time
  • Trying htop with unsupported flags

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes