InMotion Hosting Support Center

There are several programs available for you to use to edit files while in the Linux command line. Here at InMotion Hosting, our System Administration team primarily uses programs called nano and vi. Vi is a very sophisticated program with somewhat of a high learning curve. Because of this, we're going to show you how to edit files using nano.

When editing files with nano, the first thing you'll need to do is make sure that you've connected to your server via SSH. If you need assistance with doing this, please see How to login to your server via SSH.

We're currently logged in, so let's run pwd to see what directory we're in, and then ls to see what files are in this directory: [~/testa]# pwd
/home/user5/testa [~/testa]# ls -alh
total 8.0K
drwxr-xr-x 2 user5 user5 4.0K Dec 7 18:43 ./
drwx--x--x 10 user5 user5 4.0K Dec 6 08:16 ../
-rw-r--r-- 1 user5 user5 0 Dec 7 18:43 file1.txt
-rw-r--r-- 1 user5 user5 0 Dec 7 18:43 file2.txt
-rw-r--r-- 1 user5 user5 0 Dec 7 18:43 file3.txt

As you can see, we're in the testa folder, and there are currently three files: file1.txt, file2.txt, and file3.txt. If we wanted to edit file2.txt using nano, enter the following command: [~/testa]# nano file2.txt

After running this command, the nano file editor will open and load the contents of file2.txt:

GNU nano 1.2.4                   File: file2.txt

                                [ Read 0 lines ]
^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Txt ^T To Spell

What you're looking at above is a blank file loaded into nano. The top line shows the version of nano you're using and the name of the file you're editing. The bottom part of the screen includes all of the commands that you can run.

So what do you do now? Start editing the file! You can edit the file as you would using any other editor, except you don't have the option to use your mouse to point and click on items.

Then what?

The commands at the bottom of the page are executed by holding down Ctrl on your keyboard followed by the letter listed. For example, if you wanted to save the file (referred to as "WriteOut"), hold Ctrl + O on your keyboard. When you're ready to exit nano, hold Ctrl + X and you will be exited from the application.

Looking For Dedicated Hosting?

Using SSH provides a faster method for managing a dedicated server hosting environment. You can learn more about what makes else makes dedicated servers so fast here.

Support Center Login

Social Media Login

Social Login Joomla

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

0 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!