Using the nano text editor
Note: This page applies to SFTP Gateway version 2.x. Visit Here for documentation on version 3.x.
Overview
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:
cd
(Changing directory with no parameters will take you to your home directory)
Create a blank text file:
touch test.txt
You can verify that the file exists:
ll
(this stands for "long listing", and is a shortcut for ls -la
)
Next, edit the test.txt
file using nano:
nano test.txt
You should see a large blank area where you can type and edit freely:
To save and quit, use the keyboard shortcut Ctrl-X
.
The bottom helper text will change to this:
Choose Yes
by typing the uppercase letter Y
.
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
<Enter>
.
You are now at the command prompt again. To verify that your changes took effect, type:
cat test.txt
And you will see the output:
hi this is a test file