Thorn Tech Marketing Ad
Skip to main content
Version: 1.2.1

Editing Files on Linux: nano & vi

TLDR

Purpose: Edit configuration files on the StorageLink VM from the command line.

nano (beginner-friendly): nano file.txt → type → Ctrl+XYEnter

vi (powerful, pre-installed everywhere): vi file.txti to insert → Esc:wq to save and quit

Tip: nano shows its commands at the bottom of the screen; vi has separate Insert and Command modes.

Product: StorageLink by Thorn Technologies — cloud storage gateway for secure file sharing

Overview

After you SSH into the StorageLink VM, you sometimes need to edit a file by hand — for example /opt/swiftgw/application.properties to adjust the password policy or other application properties. Two terminal text editors are available on the VM:

  • nano — user-friendly, with on-screen command hints. Best if you're new to the command line.
  • vi — powerful and available on virtually every Linux system, but it uses modes you need to learn.

Use whichever you prefer. The tabs below cover each editor.

The nano text editor is a user-friendly, terminal-based editor pre-installed on most Linux distributions, including the one StorageLink runs on. Unlike vi, there are no modes to learn — what you see is what you edit, and the available commands are listed at the bottom of the screen.

Creating and editing a file

1. Navigate to your directory

cd /path/to/your/directory

Tip: Running cd with no path takes you to your home directory.

2. Create a new file or open an existing one

nano test.txt

Replace test.txt with your file name. If the file doesn't exist, nano creates it when you save. To verify a file exists, run:

ll

This stands for "long listing" — a shortcut for ls -la.

3. Edit the file

  • Enter text: start typing.
  • Navigate: use the arrow keys to move the cursor.

You should see something like this:

The nano editor showing the text "hi this is a test file" with the command list at the bottom

4. Save and exit

Press Ctrl+X to exit. The bottom helper text changes to ask whether to save:

The nano "Save modified buffer" prompt with Yes, No, and Cancel options

Choose Yes by typing the uppercase letter Y. Nano then prompts for the file name to save to:

The nano "File Name to Write" prompt pre-filled with test.txt

To accept the existing name, press Enter. You return to the command prompt. Verify your changes with:

cat test.txt

You'll see the file's contents:

hi this is a test file