Technical skill

Linux command: nano

Subject: .../LINUX

Make a small text change in a terminal

GNU nano is a text editor that runs inside a terminal, a window or screen for typing commands and text. It can edit notes, configuration files, and scripts. You type at the cursor, and the file on disk changes when you save. The shell variable $HOME contains the current account’s home folder. Start nano with the file path:

nano "$HOME/notes.txt"

If notes.txt exists there, nano opens it. If it does not, nano creates a new empty buffer, a temporary editing copy, and uses that path when you save. Nano is modeless: ordinary keys insert text instead of switching between separate command and typing modes.

Find the keys for each action

The two lines at the bottom of nano show common shortcuts. Press Ctrl+G to open its built-in help and check the shortcuts for the installed version. Nano writes ^ for Ctrl and M- for Meta, usually Alt. If the terminal does not send a Meta key combination directly, an Escape sequence may work instead. Shortcuts can differ between versions or in a nanorc configuration file, so use the on-screen help if a remembered key does something unexpected.

Use the arrow keys to move the cursor, then type to insert text. Ctrl+K cuts the current line into nano's cutbuffer, a temporary place for text, and Ctrl+U pastes that text at the cursor. This moves or temporarily removes a line; it does not permanently delete it. Search and replace commands are listed in nano's help. Review replacements before saving important text.

Save, exit, and check the file

Press Ctrl+O (Write Out) to save. Check the name shown in the prompt, then press Enter to confirm it. Ctrl+X exits. If changes are not saved, nano asks whether to write them; choose yes to keep them or no to discard them. A save can fail because the parent folder is missing, the filesystem is read-only, or the process lacks permission. Read the status message before trying again.

To open near a diagnostic line, put a line number before the path, as in nano +42 "$HOME/notes.txt". Nano moves the cursor to line 42; it does not check the surrounding text or verify that a configuration file is valid. After editing configuration, run the relevant parser or application check, then confirm the service accepts it. Keep a recoverable copy or use version control before editing an important file. Nano can create backups when configured or invoked with the right option; check where they are written. It does not gain elevated permission by itself, so saving still depends on the account's access to the file. Confirm the name in the prompt so a typo does not leave the original untouched and create another file instead.

Interactive exercises

Materials

Skillsets
Skillset Devops preview
image descriptionDevops
by Dio
3 users
Skillset Linux administrator preview
image descriptionLinux administrator
by Infinite Education
3080 users
Skillset Devops preview
image descriptionDevops
by Ajay Kumar
2004 users
Skillset Linux for backend developer preview
image descriptionLinux for backend developer
by Artem Naumenko (fb)
16 users
Skillset Skyeng SRE preview
image descriptionSkyeng SRE
by Yuliya Marochkina
12 users
Skillset Skyeng Senior PlatOps preview
image descriptionSkyeng Senior PlatOps
by Artem Naumenko (slack2)
7 users
Skillset Skyeng Ops (for DevOps) preview
image descriptionSkyeng Ops (for DevOps)
by Roman Burnashev
2 users
Do you know that ...?
Any useful or interesting facts about the skill. Any peace of information would be useful