AI Hints
Home›Linux Tutorial›The Prompt and echo
Linux · Lesson 8 of 120

echo and Arguments

Giving commands extra words.

⏱ 2 min read▶ Video at 7:44🎓 Free
Watch this lesson in the Linux courseWatch on YouTube ↗Full Linux course

Most commands can take extra words after their name. These extra words are called arguments. They tell the command what to work on. The easiest command to see this with is echo.

echo and Arguments
From the video: echo and Arguments
  • Commands take extra words
  • They're called arguments
  • echo shows how

echo repeats you

Echo simply prints back whatever you give it. Echo hello prints hello. Echo with three words prints all three, separated by single spaces. Each word after the command name is one argument.

Terminal
echo hello
hello
echo Linux is fun
Linux is fun

Quotes keep words together

Watch what happens to extra spaces. Without quotes, the shell splits your text into separate words, and echo joins them with single spaces. Put the text in quotes, and the shell treats it as one single argument, spaces and all.

Terminal
echo one     two
one two
echo "one     two"
one     two

The shape of a command

Almost every command has the same shape. First the command name. Then options, which start with a dash, and change how the command behaves. Then the arguments, which say what to work on. Spaces separate each part. We'll meet options properly in a moment.

Namewhich program
Options-l, -a, change behaviour
Argumentswhat to work on
Spacesseparate the parts

Summary

Commands take arguments, separated by spaces, and quotes keep words together. Next, two huge time savers. History, and tab completion.

Key takeaways
  • echo prints its arguments
  • Spaces split arguments
  • Quotes keep them together
Next up: History and Tab Completion — typing less