Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Google Cloud

How to use Nano Editor in Linux (Ubuntu/Debian/CentOS)

by Cloudbooklet
4 years ago
in Google Cloud
How To Use Nano Editor In Linux (Ubuntu/Debian/Centos)
ShareTweetSendShare
Readers like you help support Cloudbooklet. When you make a purchase using links on our site, we may earn an affiliate commission.

How to use Nano Editor in Linux operating systems like Ubuntu or Debian or CentOS. Nano is one of the easiest command line text editor with syntax highlighting, multiple buffers, search and replace with regular expression support, spellchecking, UTF-8 encoding, and more. In this guide you are going to learn how to use Nano editor […]

ADVERTISEMENT

How to use Nano Editor in Linux operating systems like Ubuntu or Debian or CentOS. Nano is one of the easiest command line text editor with syntax highlighting, multiple buffers, search and replace with regular expression support, spellchecking, UTF-8 encoding, and more.

In this guide you are going to learn how to use Nano editor using terminal commands and perform various operations like create, open, edit, save, search and replace, cut, copy, paste and more in Nano editor.

Prerequisites

Nano editor installed in your system or server.

ADVERTISEMENT

If you don’t have Nano installed you can install it easily using the following command.

You might also like

How To Setup Ssh Keys On Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

4 months ago
Draggan Ai Editing Tool Install And Use Draggan Photo Editor

DragGAN AI Editing Tool Install and Use DragGAN Photo Editor

4 months ago

Install Nano on Ubuntu/Debian

To install Nano on Ubuntu or Debian execute the below command from your terminal or SSH.

sudo apt install nano

Install Nano on CentOS/Fedora

To install Nano on CentOS or Fedora execute the below command from your terminal or SSH.

ADVERTISEMENT
sudo yum install nano

Basic Control Characters and Keys

There are keyboard combinations for each function in Nano. Control shortcuts (used with the CTRL button) are represented by a carat (^) followed by a symbol.

For example, the shortcut to Exit out of the Nano text editor is CTRL+X(displayed as ^X).

ADVERTISEMENT

In addition, there are combinations that require the Meta key (usually the ALT button). They are represented by the letter M followed by a symbol.

For example, the shortcut to Undo an action in a text is ALT+U (displayed as M-U).

ADVERTISEMENT

1. Create and open a new file with Nano

To create and open a new file you can directly use the nano command with the filename as shown below.

You can also use this command to open an existing file with name.

ADVERTISEMENT
sudo nano filename.txt

To exit the editor you can use CTRL + X. If you have modified the file you will be prompted to save the changes or ignore it by typing Y for yes and N for no.

2. Search using Nano

To search for a particular word or part of a text inside the editor, use the “where is” option with the CTRL+W shortcut (^W). This will open a search prompt where you can type in the text you want to find. To continue to the next result, use ALT+W (M-W).

The search bar can also find specific line numbers. Press CTRL+T (^T) while in it and the line number you want to find.

Regex search

You can also search with regex (regular expressions). These represent a search pattern defined by a sequence of characters. To do so, use the ALT+R shortcut (M-R).

3. Replace Text with Nano

To search and replace, press CTRL+/. Enter the search term and the text to be replaced with. The editor will move to the first match and ask you whether to replace it.

After hitting Y or N it will move to the next match.

Pressing A will replace all matches.After you have selected the search item, it will ask what you want to replace it with.

4. Cut, Copy and Paste using Nano

To select text, move the cursor to the beginning of the text and press ALT+A. This will set a selection mark. Move the cursor to the end of the text you want to select using the arrow keys. The selected text will be highlighted. If you want to cancel the selection press CTRL+6

Copy the selected text to the clipboard using the ALT+6 command.

To cut the selected text CTRL+K combination.

You can also cut whole lines by simply moving the cursor to the line and press CTRL+K. You can cut multiple lines by hitting CTRL+K several times.

To paste the text move the cursor to where you want to put the text and press CTRL+U.

5. Copy Another File Into the Current File

While editing a file in Nano, it is also possible to insert the entire contents of another file into the current one with the CTRL+R (^R) shortcut.

This command will open the bottom bar in which you must write the path and file name you wish to import.

6. Keyboard Shortcuts for Nano

While editing large files the following keyboard shortcuts will be highly helpful to navigate easily within the file.

  • Move forward one character: Ctrl+F (^F)
  • Move back one character: Ctrl+B (^B)
  • Move forward one word: Ctrl+Space (^Space)
  • Move back one word: Alt+Space (M-Space)
  • Move to the previous line: Ctrl+P (^P)
  • Move to the next line: Ctrl+N (^N)
  • Move to the next page: Ctrl+V (^V)
  • Move to the previous page: Ctrl+Y (^Y)
  • Move to the beginning of the line: Ctrl+A (^A)
  • Move to the end of the line: Ctrl+E (^E)

Prepare yourself for a role working as an Information Technology Professional with Linux operating system

Conclusion

Now you have learned how to perform various operations using Nano editor on Ubuntu or Debian or CentOS systems.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Tags: CentOSDebianUbuntu 18.04
Share3Tweet2SendShare
Cloudbooklet

Cloudbooklet

Comments 2

  1. Avatar Of Omar Omar says:
    4 years ago

    Nice guide, tanks!

    Reply
    • Avatar Of Cloudbooklet Cloudbooklet says:
      4 years ago

      Thank you too for using cloudbooklet

      Reply

Leave a Reply Cancel reply

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

Related Posts

Set Up Deep Learning With Nvidia, Cuda, Cudnn On Ubuntu

How to Set Up Deep Learning with Nvidia, CUDA, cuDNN on Ubuntu 22.04

7 months ago
How To Install Or Upgrade Php 8.2 On Ubuntu 22.04

How to Install or Upgrade PHP 8.2 on Ubuntu 22.04

9 months ago
How To Change Timezone On Ubuntu 22.04

How to Change Timezone on Ubuntu 22.04

1 year ago
How To Install Ansible On Ubuntu 22.04

How to Install Ansible on Ubuntu 22.04

1 year ago

Follow Us

Trending Articles

Fantasy Minecraft Servers

5 Best Fantasy Minecraft Servers in 2023

September 21, 2023

How to Block YouTube Ads on Android TV in 2023 (6 Easy Methods)

Microsoft Unveils New Disc-Less Xbox Series X with Lift-to-Wake Controller

Microsoft Editor vs Grammarly: Which is the Best Grammar Checker?

Best 10 AI Comic Generator: Create Comic book in Seconds

Validator AI: The AI Powered Business Idea Validator

Popular Articles

Ai Girl Generator

7 Best AI Girl Generators for Creating Realistic and Beautiful AI Girls

September 19, 2023

Top 9 Slideshow Makers for Bloggers and Content Creators

How to Use Midjourney FaceSwap to Create Images with Your Face

7 Best AI YouTube Thumbnail Maker for Better Video Engagement

10 Apps to See Who Viewed Your Instagram Profile

How to Use Canva on ChatGPT: A Step-by-Step Guide

Subscribe Now

loader

Subscribe to our mailing list to receives daily updates!

Email Address*

Name

Cloudbooklet Logo

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Applications
  • Linux

Cloudbooklet © 2023 All rights reserved.