Nano Text Editor Tutorial¶
Nano is a simple and user-friendly terminal-based text editor that is ideal for quick edits or beginner users. In this tutorial, you’ll learn the basics of using Nano.
Opening a File with Nano¶
To open or create a file in Nano, use the following command in your terminal:
nano filename.txt
If filename.txt exists, it will be opened for editing. If the file does not exist, it will be created.
Basic Navigation¶
The main navigation keys in Nano:
Arrow keys
: Move the cursor up, down, left, or right.
Ctrl + A
: Move the cursor to the beginning of the current line.
Ctrl + E
: Move the cursor to the end of the current line.
Ctrl + Y
: Move up one page.
Ctrl + V
: Move down one page.
Editing Text
Start typing to add text at the cursor position.
Use the Backspace or Delete key to remove characters.
Ctrl + K
: Cut the current line.
Ctrl + U
: Paste the last cut line or block of text.
Saving and Exiting¶
Once you’ve finished editing, you can save and exit Nano with the following commands:
Ctrl + O
: Save the current file. Nano will prompt you to confirm the filename. Press Enter to save.
Ctrl + X
: Exit Nano. If there are unsaved changes, Nano will ask if you want to save before exiting.
Searching and Replacing Text¶
To search for text in Nano:¶
Ctrl + W
: Open the search prompt. Type the word or phrase you want to find and press Enter.
To search and replace text:
**Ctrl + **
: Open the search and replace prompt. Nano will ask for the search string and then the replacement string.
Other Useful Commands
Some additional commands that might be useful:¶
Ctrl + G
: Show help information with a list of all commands.Ctrl + C
: Display the current cursor position (line and column).Ctrl + T
: Open the spell-checker (if installed).Ctrl + _
: Jump to a specific line number.
Summary of Shortcuts¶
Ctrl + O
: Save the file.Ctrl + X
: Exit Nano.Ctrl + W
: Search for text.Ctrl + K
: Cut the current line.Ctrl + U
: Paste the last cut text.Ctrl + G
: Open the help menu.Ctrl + Y
: Move up one page.Ctrl + V
: Move down one page.