Introduction
Nano is a simple and friendly text editor that runs directly in the Linux terminal. Ideal for users who need to make quick modifications without the complexity of vim or emacs.
Installation and availability
Most modern distributions include nano by default. If it is not present, it can be installed with the corresponding package manager:
- Debian/Ubuntu:
sudo apt-get install nano - Fedora:
sudo dnf install nano - Arch Linux:
sudo pacman -S nano
Basic interface
When launching nano with nano nombre_archivo a screen divided into three areas is shown: the edit buffer, the status bar, and the help menu at the bottom. Key combinations are indicated with the ^ symbol (Ctrl) or M (Meta).
Essential commands
- ^G (Ctrl+G): shows the full help.
- ^O (Ctrl+O): writes the file (save).
- ^X (Ctrl+X): exits the editor; prompts to save if there are unsaved changes.
- ^K (Ctrl+K): cuts the current line and stores it in the clipboard.
- ^U (Ctrl+U): pastes the clipboard contents at the cursor position.
- ^W (Ctrl+W): starts a search.
- ^\\ (Ctrl+\\): replaces text.
Customization via nanorc
The behavior of nano can be adjusted by editing the configuration file ~/.nanorc or the global /etc/nanorc. Some useful options:
set linenumbersdisplays line numbers.set autoindentenables automatic indentation.set tabsize 4sets the tab size.set constconstantly shows the cursor position.
Advantages and limitations
Nano stands out for its low learning curve and availability in almost any environment without needing additional configuration. However, for advanced tasks such as code editing with advanced syntax highlighting or complex macros, editors like vim or emacs may be more suitable.
Conclusion
Mastering nano is a practical skill for any system administrator or developer working in Linux environments. Its simplicity makes it the tool of choice for quick edits, while its configurability allows it to be adapted to specific needs.
This post is also available in ESPAÑOL.