Search results for:
Table of Contents
Nano editor and how to use this text editor to edit files on your server is what we will cover in this guide. Nano is found on most Linux distributions and is easy to use, with its most often used commands shown at the bottom of its screen. As editing configuration and other files is a prevalent task in Linux, knowing how to use this program can be quite useful.
Commands in nano are begun with the CTRL key and usually followed by a letter. Within the nano program, the CTRL key is shown as a ^ symbol at the bottom of its screen like this:
As indicated in the above image, you can also press CTRL G to view nano's help page.
Here are some examples of usage:
To open a file for editing, you would type nano at the command line followed by the filename:
nano [some file] nano /etc/hostname
To create a new file, you would type nano at the command line, with or without the file name you wish to use:
If you don't enter the filename, it will open a blank file, and you will be asked for the filename when saving it.
To Write Out or Save the file you have been editing, press CTRL + O. It will then prompt you for the filename to save.
Hit the enter key when done.
When you are done editing the file, type CTRL + X to close the file. If you have made any changes to the file, you will be prompted to save or discard those changes. If you haven't made any changes to the file, the editor will just close, returning you to the command line again.
Written by Christopher Langdon / November 8, 2019