Using the nano text editor
Both nano and vim are pre-installed on the Linux operating system. They are built-in text editors that are frequently used, since Linux servers typically do not have a GUI.
The nano text editor is easier to learn, so this article is going to cover how to use nano.
Vim has a bit of a learning curve, but it can do some amazing things in the hands of an experienced user.
Practicing with nano on a test file
First, change directory to a safe location, such as your home directory:
(Changing directory with no parameters will take you to your home directory)
Create a blank text file:
You can verify that the file exists:
(this stands for "long listing", and is a shortcut for
Next, edit the
test.txt file using nano:
You should see a large blank area where you can type and edit freely:
To save and quit, use the keyboard shortcut
The bottom helper text will change to this:
Yes by typing the uppercase letter
You should see this screen:
Nano is now prompting you to save your changes to the file
test.txt. To accept this value and continue, hit
You are now at the command prompt again. To verify that your changes took effect, type:
And you will see the output:
hi this is a test file