Contents
How do you write to a text file in Linux?
How to create a text file on Linux:
- Using touch to create a text file: $ touch NewFile.txt.
- Using cat to create a new file: $ cat NewFile.txt. …
- Simply using > to create a text file: $ > NewFile.txt.
- Lastly, we can use any text editor name and then create the file, such as:
How do I add text in Linux terminal?
You need to use the >> to append text to end of file. It is also useful to redirect and append/add line to end of file on Linux or Unix-like system.