수. 7월 23rd, 2025

Linux Nano Editor Interface
Basic Nano interface with key shortcuts displayed

What is Nano?

Nano is a beginner-friendly command-line text editor in Linux. Unlike complex editors like Vim, Nano shows common shortcuts at the bottom of the screen, making it perfect for newcomers. Here are 30 essential commands to master Nano:


🚀 Basic Operations

  1. Open a file
    nano filename.txt
    Creates or opens existing file

  2. Save changes
    Ctrl + O → Press Enter
    Write Out changes to disk

  3. Exit Nano
    Ctrl + X
    Exits editor (prompts to save unsaved changes)

  4. Save & Exit
    Ctrl + XY → Enter
    Fast save-and-quit combo

Nano Save Prompt Example
Saving confirmation prompt in Nano


✏️ Editing Commands

  1. Undo action
    Alt + U
    Reverts last edit

  2. Redo action
    Alt + E
    Re-applies undone edit

  3. Cut entire line
    Ctrl + K
    Removes current line

  4. Paste text
    Ctrl + U
    Inserts cut/copied content

  5. Copy text
    Alt + ^ (Ctrl+6)
    First set mark with Ctrl + ^

  6. Delete character
    Ctrl + D
    Deletes under cursor


🔍 Navigation Shortcuts

  1. Move cursor
    Arrow keys
    Basic navigation

  2. Jump to line
    Ctrl + _ → Type line number
    Go directly to specific line

  3. Page up/down
    Ctrl + Y / Ctrl + V
    Scroll through document

  4. Start of line
    Ctrl + A
    Moves to line beginning

  5. End of line
    Ctrl + E
    Moves to line end

  6. Start of file
    Alt + \
    Jump to first line

  7. End of file
    Alt + /
    Jump to last line


🔎 Search & Replace

  1. Find text
    Ctrl + W → Type search term
    Basic search

  2. Find next occurrence
    Alt + W
    Repeats last search

  3. Replace text
    Ctrl + \
    Search and replace mode

  4. Case-sensitive search
    Alt + C to toggle
    Enable/disable case matching


🛠️ Advanced Functions

  1. Insert file
    Ctrl + R → Filename
    Embed another file’s content

  2. Spell check
    Ctrl + T
    Requires spell package installed

  3. Auto-indent toggle
    Alt + M
    Enable/disable auto-indentation

  4. Show cursor position
    Ctrl + C
    Displays line/column info

  5. Multiple buffers
    Alt + , / Alt + .
    Switch between open files

Nano Multiple Buffer View
Working with multiple files in Nano


💾 File Operations

  1. Save as new name
    Ctrl + O → New name → Enter
    Creates copy with different filename

  2. Insert backup file
    Ctrl + Rfilename.save
    Recover from automatic backups


⚙️ Configuration Tips

  1. Enable line numbers
    Alt + Shift + #
    Toggle line numbering

  2. Syntax highlighting
    Install with:
    sudo apt install nano-syntax
    Enable in config:
    include /usr/share/nano/*.nanorc


Pro Tip:

Create ~/.nanorc file with these lines for permanent settings:

set autoindent
set tabsize 4
set linenumbers

> 💡 Did You Know? Nano automatically creates .save backup files when editing system files – your safety net against accidental changes!

Master these 30 commands and you’ll efficiently edit configuration files, scripts, and documents directly in the terminal. Happy editing! 🐧

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다