Bird
0
0

What will be the output of the command echo -n Hello World?

medium📝 Command Output Q13 of 15
Linux CLI - Linux Basics and Terminal
What will be the output of the command echo -n Hello World?
AHello World followed by a new line
B-n Hello World
CHello World without a new line
DError: invalid option
Step-by-Step Solution
Solution:
  1. Step 1: Understand the echo command and -n option

    The 'echo' command prints text. The '-n' option tells it not to add a new line at the end.
  2. Step 2: Predict output behavior

    So, 'Hello World' will print exactly as is, without moving to a new line after.
  3. Final Answer:

    Hello World without a new line -> Option C
  4. Quick Check:

    echo -n = no newline [OK]
Quick Trick: Remember: echo -n prints without newline [OK]
Common Mistakes:
  • Assuming echo always adds newline
  • Confusing -n as text
  • Expecting error from -n option

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes