printf
noun
say it: “PRINT-eff” /ˈprɪntɛf/
A terminal command that prints text from a pattern, where %s is a slot for each value and \n starts a new line.
What does printf do?
printf prints text from a pattern you give it. In the pattern, %s is a slot that each value fills in turn and \n starts a new line. Unlike echo, it works the same way on every system, so it's the safe choice for neat, several-line output.
printf '%s\n' "- buy curtains" "- call the internet company" >> todo.txt
In a sentence
- “With printf, '%s\n' put each item on a line of its own.”
- “Sam used printf to add two neat lines to the to-do list in one command.”
Level: Apprentice · More Unix terms at this level
Updated