How to use nano editor and vi editor?

mdshamsfiroz
3 min readMar 15, 2024

--

Nano Editor

Opening Files:

1.To open a file using Nano, simply type nano followed by the file name:

nano filename.txt

For example if i run this command :- nano sf . It will open this window to edit , create the file.

Basic Navigation:

Use the arrow keys to move the cursor up, down, left, or right within the file.

To move directly to the beginning or end of the file, press Ctrl + Home or Ctrl + End, respectively.

You can also use the Page Up and Page Down keys to navigate through the file.

Editing Text:

To insert or append text, simply start typing at the desired location.

Use the Backspace or Delete key to remove characters.

To cut (remove) a line of text, use Ctrl + K. To paste the cut text, use Ctrl + U.

To undo your last action, press Ctrl + U.

Saving Files:

To save the changes made to the file, press Ctrl + O.

Nano will prompt you to confirm the file name. Press Enter to confirm and save the changes.

If you want to save the changes under a different file name, simply type the new name and press Enter.

Exiting Nano:

To exit Nano, press Ctrl + X.

If you have unsaved changes, Nano will prompt you to save them before exiting. Press Y to confirm and save, or N to exit without saving.

Deleting Files:

To delete a file from within Nano, you can’t do it directly. You’ll need to exit Nano and use shell commands like rm to delete the file:

rm filename.txt

Be cautious when using the rm command, as it permanently deletes files and cannot be undone.

Additional Tips:

Nano displays a list of available commands at the bottom of the screen. Press Ctrl + G to access the help menu for more commands.

VI USER MANUAL

Vim Modes and Commands

Modes in Vim

  • Normal Mode: Default mode for navigation and editing.
  • Insert Mode: Used for explicitly inserting and modifying text. Press I to go inside insert mode.
  • Command Line Mode: Accessible by pressing Esc and then :. Used for operating Vim like saving and exiting.

Opening, Closing, and Saving Files

  • Opening a File: vim FILE_NAME
  • Quitting without Saving: :q! or :ZQ (Command Line Mode)
  • Saving and Exiting: :x! or :wq! (Command Line Mode)

So, whether you’re a tech enthusiast, a professional, or just someone who wants to learn more, I invite you to follow me on this journey. Subscribe to my blog and follow me on social media to stay in the loop and never miss a post.

Together, let’s explore the exciting world of technology and all that it has to offer. I can’t wait to connect with you!”

Connect me on Social Media:

https://linktr.ee/mdshamsfiroz

--

--

mdshamsfiroz

Trying to learn tool by putting heart inside to make something