1. Create a folder to store the text files you want to create, for example, create a folder called testToCreateText
Step 2: Open your terminal
3. Step 3, enter CD in the terminal, and then space, then drag the folder you created to the terminal interface, so that the terminal will automatically generate your folder path, and then directly enter
4. Step 4, enter vim in terminal, then space, enter the name of the text you want to create, add the suffix.text, and press Enter
5. Step 5: Enter text editing. After reaching this interface, press the “I” key (” I “key) to enter the editing state
6. Step 6: Now that you have entered the text editing state, you can edit the content as you like
7. Step 7: Edit the following content and type a few words at random
8. In step 8, after editing the content, exit the text editing by pressing “ESC”
9. Step 9, now in the exit state, enter “:wq” and press Enter, as shown in the following figure
10. In step 10, after exiting the text editing, you can close the terminal, and now go to the testToCreateText folder to find the text file you just created
11. Step 11, find the text file we just created, and complete the operation of creating text with the terminal
Reference from: http://jingyan.baidu.com/article/4b52d7027219dbfc5c774b03.html