Languages
[Edit]
EN

Bash - append output at the end of text file

0 points
Created by:
Root-ssh
178180

In this article, we would like to show you how to append output at the end of text file in Bash.

Quick solution:

Where:

  • command_name - is name of the command that returns some output,
  • file_name - is name of the text file where we want to append the command output.

 

Practical example

Edit

In this example, we use echo command that displays a line of text that is passed in as an argument. Using >> operator we "redirect" its output and append it at the end of file.txt.

Note:

This operation will write at the end of file.txt leaving the previous content. If you want to overwrite the whole file content, use > instead of >> operator.

 

See also

Edit
  1. Bash - write output to text file (overwrite)

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join