Linux basicsWritten by GLWS8 min readUbuntu 24.04 LTS / AlmaLinux 9
Commands run on your server unless a section says otherwise. Replace example usernames, addresses and paths with your own values. Keep a working session open when changing remote access.

Check whether nano is available

Nano is a terminal text editor suitable for small configuration files and notes. This guide applies to Ubuntu 24.04 LTS and AlmaLinux 9. Start with a normal SSH login and check the installed version. If the command is missing, install the package using only the command matching your operating system.

Installing software requires an account permitted to use sudo. If you are already logged in as root, omit sudo. Package installation may prompt for confirmation; review the package list before accepting.

Check the installed editor
nano --version
Install on Ubuntu 24.04 LTS if needed
sudo apt update
sudo apt install nano
Install on AlmaLinux 9 if needed
sudo dnf install nano

Open a practice file

Start in your home directory and open a new, unused filename. If my-server-notes.txt already exists, choose a different filename for this exercise. Nano displays the filename at the top and shortcut hints near the bottom.

Type two short lines, such as a hostname and a reminder to check disk space. Move with the arrow keys and use Backspace or Delete to correct text. There are no separate command and typing modes. Avoid pasting unrelated terminal commands into a configuration file.

Open your practice notes
cd
nano my-server-notes.txt

Save and exit

In the shortcut hints, ^ means Ctrl. Press Ctrl+O to write the file, confirm the filename with Enter, then press Ctrl+X to exit. This save sequence works with the nano versions commonly supplied by both target distributions.

If you exit with unsaved changes, nano asks whether to save. Choose Y to save and confirm the filename, or N to discard the pending edits. Once back at the shell, inspect the file. Expect the exact lines you typed, with no keyboard shortcut text included.

Verify the saved contents
cat my-server-notes.txt
GNU nano showing the practice file saved successfully.
Recorded terminal state from the real Nano edit-and-save test, rendered from the captured terminal cells. “Wrote 3 lines” confirms the save.

Find text and keep a backup

Reopen the notes and press Ctrl+W, type a word from the file, then press Enter to find it. Ctrl+G opens built-in help; Ctrl+X leaves the help view. Ctrl+K cuts the current line, and Ctrl+U pastes it back.

Before modifying an important existing file, make a backup outside the editor. The -i option asks before overwriting an earlier backup. For protected system configuration, use sudoedit with nano as the selected editor after checking the file's instructions.

Back up the practice file before another edit
cp -i my-server-notes.txt my-server-notes.txt.bak
nano my-server-notes.txt

Handle a failed save

A permission-denied error means your account cannot write the file or its directory. Check ownership and the path instead of repeatedly pressing save. A full filesystem can also prevent writing. If valuable edits are still open, Ctrl+O lets you save to a new file in your home directory.

Inspect write access and free space
ls -l my-server-notes.txt
ls -ld .
df -h .
Back up service configuration and use the service's validation command before reloading it. Saving a text file alone does not confirm that its syntax is valid.

Official documentation

These upstream references provide more detail on the commands and workflows in this guide.