Nano is a user-friendly command-line text editor for Unix-like systems, such as CentOS and AlmaLinux. It offers a simple interface with essential features and intuitive keyboard shortcuts.
Key Features of Nano
- Simple Interface: Clean and minimalistic, with a text editing area, status bar, and keyboard shortcuts displayed at the bottom.
- Keyboard Shortcuts: Perform actions like saving, searching, copying, cutting, and pasting with easy-to-remember shortcuts.
- Syntax Highlighting: Supports various programming and markup languages, enhancing readability.
- Search and Replace: Quickly search for text within a file and replace it.
Step 1: Install Nano
First, check if Nano is already installed:
which nano
- If installed, you’ll see the path to Nano, like
/usr/bin/nano
. - If not, you’ll see an error message.
To install Nano, run:
yum install nano
Step 2: Using Nano
To open a file with Nano, use:
nano filename
For example, to edit test.txt
:
nano test.txt
Basic Commands
- Save changes: Press
Ctrl + O
, thenEnter
. - Exit Nano: Press
Ctrl + X
. - Exit without saving: Press
Ctrl + X
, thenN
when prompted.
Explore more commands by pressing Ctrl + G
inside Nano for the help menu.
That’s it! You’ve successfully installed and started using Nano on your CentOS or AlmaLinux system. Happy editing!