Can linux cat command be used for writing text to file?

Is something like this:

cat "Some text here." > myfile.txt

Possible? Such that the contents of myfile.txt would now be overwritten to:

Some text here.

This doesn’t work for me, but also doesn’t throw any errors.

Specifically interested in a cat-based solution (not vim/vi/emacs, etc.). All examples online show cat used in conjunction with file inputs, not raw text…

13 Answers
13

Leave a Comment