MangoHost Blog / Beginner’s Guide to Linux Nano Package – Editing Text Files from SSH
Beginner’s Guide to Linux Nano Package – Editing Text Files from SSH

Beginner’s Guide to Linux Nano Package – Editing Text Files from SSH

If you are new to Linux or looking for a simple and easy-to-use text editor, Nano is a great choice. Nano is a command-line text editor that comes pre-installed on most Linux distributions and is known for its simplicity and user-friendly interface. In this guide, we will explore the features and usage of Nano, along with some useful commands and examples.


As mentioned earlier, Nano is usually pre-installed on most Linux VPS, even in minimal version. However, if it is not available on your system, you can install it using the package manager specific to your distribution. For example, on Ubuntu, you can use the following command:

sudo apt-get install nano

Nano Features

  • Search and Replace: Nano allows searching for text and optionally replacing it.
  • Auto-indentation: Provides automatic indentation to maintain coding styles.
  • Mouse Support: Supports mouse operations to place the cursor, scroll the buffer, and select text.
  • Soft Wrapping: Soft wrapping of long lines to the next line.
  • Multi-buffer: Ability to open and edit multiple files.
  • Syntax Highlighting: Highlights syntax for various programming languages.
  • Interactive Search: Incremental search feature that shows results as you type.
  • Undo/Redo: Supports multiple levels of undo and redo.
  • Spell Check: Built-in spell checker can be invoked within the editor.
  • Customizable Key Bindings: Allows customizing key bindings including rebinding keys for commands.
  • Color Schemes: Supports color schemes for syntax highlighting and interface elements.
  • File Management: Options to automatically save files, backup files before saving, and converting files from DOS/Mac formats.

Nano Commands

  • Open File: nano filename – Open ‘filename’ for editing.
  • Save File: Ctrl + O – Save the file.
  • Exit: Ctrl + X – Exit the editor. Prompts to save if changes are unsaved.
  • Cut Text: Ctrl + K – Cut the current line or selected text.
  • Paste Text: Ctrl + U – Paste previously cut text.
  • Search Text: Ctrl + W – Search for text. Repeat to search for next occurrence.
  • Replace Text: Ctrl + \\ – Search and replace text.
  • Go to Line: Ctrl + _ – Go to specified line number.
  • Undo: Alt + U – Undo last operation.
  • Redo: Alt + E – Redo last undone operation.
  • Toggle Help: Ctrl + G – Show/hide help screen.
  • Toggle Soft Wrapping: Alt + $ – Turn soft wrapping on or off.

Advanced Editing

Nano also provides some advanced editing features. Here are a few examples:

  • Alt + A: Select the entire text
  • Alt + 6: Copy the selected text
  • Alt + 2: Paste the copied text
  • Alt + 3: Cut the selected text
  • Alt + 4: Undo the last action

Similar Commands

While Nano is a popular choice for text editing on Linux, there are other commands that serve a similar purpose. Some of the alternatives to Nano include:

  • Vi/Vim: Another popular command-line text editor with advanced features.
  • Emacs: A powerful text editor that offers a wide range of functionalities.
  • Pico: A lightweight and easy-to-use text editor, similar to Nano.

Benefits of Nano

So, why should you choose Nano over other text editors? Here are some benefits of using Nano:

  • Simplicity: Nano has a straightforward interface, making it easy to use for beginners.
  • Lightweight: Nano is a lightweight text editor that consumes minimal system resources.
  • Intuitive Keybindings: Nano uses simple keybindings for various operations, making it quick and efficient to use.
  • Wide Availability: Nano is pre-installed on most Linux distributions, ensuring its availability on different systems.


Nano also supports scripting, allowing you to automate certain tasks. Here is an example of a simple Nano script:

# This is a simple Nano script
echo "Hello, Nano!"
echo "This script demonstrates the usage of Nano for scripting."
# Add your commands here
echo "Script execution completed."

Save the above script in a file with the “.sh” extension, and make it executable using the following command:

chmod +x

To execute the script, use the following command:



Nano is a versatile and user-friendly text editor that is widely used in the Linux community. Whether you are a beginner or an experienced user, Nano provides all the essential editing features you need. With its simplicity and availability, Nano is an excellent choice for quick and efficient text editing on Linux.

Command Description
Ctrl + O Save the file
Ctrl + X Exit Nano
Ctrl + G Display the help menu
Ctrl + W Search for a specific word or phrase
Ctrl + K Cut the current line
Ctrl + U Paste the cut line

This article incorporates information and material from various online sources. We acknowledge and appreciate the work of all original authors, publishers, and websites. While every effort has been made to appropriately credit the source material, any unintentional oversight or omission does not constitute a copyright infringement. All trademarks, logos, and images mentioned are the property of their respective owners. If you believe that any content used in this article infringes upon your copyright, please contact us immediately for review and prompt action.

This article is intended for informational and educational purposes only and does not infringe on the rights of the copyright owners. If any copyrighted material has been used without proper credit or in violation of copyright laws, it is unintentional and we will rectify it promptly upon notification. Please note that the republishing, redistribution, or reproduction of part or all of the contents in any form is prohibited without express written permission from the author and website owner. For permissions or further inquiries, please contact us.

Leave a reply

Your email address will not be published. Required fields are marked