- Enter
:q!
and press Enter to exit vimtutor.
From your current location in the terminal, enter vim helloworld
and press Enter. You are using Vim to create a file called helloworld, and you open this file when you press Enter.
Now that you are in the file that you created called helloworld, use Vim to insert a few lines of text. Enter i
to use insert mode, and enter the following text:
Hello World!This is my first file in Linux and I am editing it in Vim!
Note: The bottom left of the terminal indicates if you are in insert mode.
Once complete, press ESC to exit insert mode.
Save your changes to the file, and enter the following command to quit:
:wq
In this exercise, you use an alternative command-line editor program called nano. Use nano to create and edit a text file.
nano cloudworld
and press Enter. You are using nano to create a file called cloudworld, and pressing Enter opens this fileFigure: The command nano followed by the file name, in this example the file is named cloudworld.
Now that you are in the file that you created called cloudworld, unlike vim, you do not have to enter insert mode. Instead, you can start typing. Enter the following text:
We are using nano this time! We can simply start typing! No insert mode needed.
To save your changes to the file, press CTRL+O. Press Enter to confirm the file name once you save it.
Now that you have saved the file, press CTRL+X to exit the nano editor.
Now that you are at the main terminal, check to make sure our file saved correctly. Enter nano cloudworld
to go back into the file using nano. Confirm that everything is correct as the following image shows, and exit the editor: