Some basic commands for using the nano text editor:

Masum KaziMasum Kazi
2 min read

Here are some basic commands for using the nano text editor:

Opening and Navigating Files

  • Open a file: nano filename

  • Move cursor: Use the arrow keys.

  • Go to a specific line and column: Ctrl + _, then enter the line and column number.

Editing Text

  • Insert text: Simply start typing to insert text at the cursor's position.

  • Cut (delete) text:

    • Cut the entire line: Ctrl + K

    • Cut selected text: Ctrl + 6 to start marking, then move the cursor and use Ctrl + K.

  • Copy (add to buffer):

    • Mark text with Ctrl + 6, move the cursor, then copy with Alt + 6.
  • Paste: Ctrl + U

Saving and Exiting

  • Save file: Ctrl + O, then press Enter to confirm.

  • Exit nano: Ctrl + X

Searching

  • Search for text: Ctrl + W, type the text, and press Enter.

  • Find next occurrence: Ctrl + W then press Enter again.

  • Search and replace: Ctrl + \, enter the search term, then the replacement term, and press Enter.

Undo and Redo

  • Undo: Alt + U

  • Redo: Alt + E

Display Help

  • View help menu: Ctrl + G

These commands cover most basic editing tasks in nano. Nano also has a built-in guide at the bottom that lists common shortcuts.

0
Subscribe to my newsletter

Read articles from Masum Kazi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Masum Kazi
Masum Kazi

A passionate learner, who loves to learn new things in this tech world.