The nano command in Linux: basic text editor in terminal

Introduction

Nano is a simple and friendly text editor that runs directly on 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 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 throwing nano withnano nombre_archivoa screen divided into three areas is shown: the editing buffer, the status bar and the help menu at the bottom. The key combinations are indicated with the symbol ^ (Ctrl) or M (Meta).

Essential commands

  • ^ G(Ctrl + G): shows the full aid.
  • ^ O(Ctrl + O): type the file (save).
  • ^ X(Ctrl + X): leaves the editor; asks to save if there are unsaved changes.
  • ^ K(Ctrl + K): cut the current line and store it on the clipboard.
  • ^ U(Ctrl + U): sticks the clipboard content in the cursor position.
  • ^ W(Ctrl + W): Start a search.
  • ^\\(Ctrl +): replace text.

Customization using nanorc

Nano behavior can be adjusted by editing the configuration file~/.nanorcor the global/etc/nanorc. Some useful options:

  • set linenumbersshows line numbers.
  • set autoindentactivates automatic bleeding.
  • set tabsize 4defines the size of the tabulation.
  • set constconstantly shows the cursor's position.

Advantages and limitations

Nano stands out for its low learning curve and availability in almost any environment without additional configuration. However, for advanced tasks such as code editing with advanced syntax highlighted or complex macros, editors such as vim or emacs may be more appropriate.

Conclusion

Dominating nano is a practical skill for any system manager or developer working in Linux environments. Its simplicity makes it the choice tool for quick editions, while its configuration capacity allows it to be adapted to specific needs.

This work is under aCreative Commons License Attribution 4.0 International for Francesc Roig francesc @ vivaldi.net.

EnglishenEnglishEnglish