There are several ways to create simple text file in Linux.
One of the easiest way to create text file is use
# cat > t1.txt
After pressing Enter, you are not returned to the prompt. Instead, the cursor is placed on the next line, allowing you to enter text into your file. Type your lines of text, pressing Enter after each one. When you are done, press Ctrl + D to exit the file and return to the prompt.
One method for creating a blank text file is to use the right arrow (>). The command below will create file but it contains no text.
# > t1.txt
Another command that works similarly to using the right arrow (>) to create an empty text file is the
# touch t1.txt
Traditional Vi is a port of the original
vi to modern Unix systems by Gunnar Ritter.
Minor enhancements include 8-bit input, support for multi-byte character encodings like UTF-8, and features demanded by POSIX.2.
It contains few additions beyond these, so it is of interest for those who look for a small but well-defined vi implementation close
to that of most commercial Unix systems.
# vi f1.txt
vi opens in command mode. To type text into the editor, type a lowercase i to enter editing mode.
Type your text and press Esc to return to command mode. To close
vi and save your file, type :wq and press Enter.
Vim "Vi IMproved" has yet more features than vi, including (scriptable) syntax highlighting, mouse support, graphical versions, visual mode, many new editing commands and a large amount of extension in the area of ex commands. Vim is included with almost every Linux distribution.
# vim f1.txt
nano is a small and friendly text editor. Besides basic text editing, it offers many extra features like an
interactive search and replace, go to line and column number, auto-indentation, feature toggles, internationalization support,
and filename tab completion.
# nano f1.txt
nano and save your file, use shorcut Ctrl + x, confirm by pressing y and press Enter.
Wikipedia: GNU nano
Nano isn’t installed by default on CentOS, but it is in the base repo.
# yum install nano
> sudo zypper in nano