[{"content":"GNU nano is a lightweight, terminal-based text editor built into almost every Linux distribution and macOS system. Unlike modal editors like Vim, nano is modeless—you type directly into the file and use Ctrl or Alt key combinations for commands.\n1. Opening and Creating Files Launch nano from your terminal by passing a filename. If the file doesn\u0026rsquo;t exist, nano creates a new buffer in memory and writes it to disk when you save.\nOpen or create a file:\nnano filename.txt Open a file at a specific line and column: (Useful for jumping to syntax errors in config files)\nnano +42,10 /etc/nginx/nginx.conf Open with line numbers displayed:\nnano -l script.sh Open in read-only mode: (Prevents accidental edits to critical system files)\nnano -v /etc/fstab Reading the Bottom Bar: The two rows at the bottom of the screen display your primary shortcuts. The caret symbol (^) represents the Ctrl key, and M- represents the Meta key (Alt on Linux/Windows, or Esc / Option on macOS).\n2. Essential Keyboard Shortcuts Action Shortcut Notes Save (Write Out) Ctrl + O Prompts for filename; press Enter to confirm. Exit Ctrl + X Prompts to save (Y or N) if there are unsaved changes. Cut Line Ctrl + K Cuts the entire current line (or highlighted selection). Paste (Uncut) Ctrl + U Pastes cut/copied text at the cursor. Copy Line Alt + 6 Copies the current line or highlighted selection. Undo / Redo Alt + U / Alt + E Reverts or reapplies recent edits. Search Ctrl + W Type search term and press Enter. Find Next Alt + W Jumps to the next occurrence of your last search. Search \u0026amp; Replace Ctrl + \\ Prompts for search term, replacement, and confirmation (Y, N, or A for All). Help Menu Ctrl + G Opens the full built-in shortcut reference (Ctrl + X to close). 3. Navigation and Text Selection Moving around large config files is much faster with jump shortcuts than holding down the arrow keys.\nBeginning / End of line: Ctrl + A / Ctrl + E (or Home / End) Page Up / Page Down: Ctrl + Y / Ctrl + V Top / Bottom of file: Alt + \\ / Alt + / Jump to a specific line: Ctrl + _ (or Ctrl + Shift + -), then type the line number and press Enter. Selecting Blocks of Text Move the cursor to the start of the text you want to select and press Alt + A (or Ctrl + 6) to set a mark. Move the cursor with the arrow keys to highlight the block. Press Ctrl + K to cut or Alt + 6 to copy, then move to the destination and press Ctrl + U to paste. 4. Customizing Your Workflow (~/.nanorc) You can configure nano\u0026rsquo;s default behavior permanently by creating or editing a .nanorc file in your home directory (nano ~/.nanorc).\n# Show line numbers in the left margin set linenumbers # Enable mouse support (click to move cursor, scroll wheel) set mouse # Convert tabs to spaces and set tab width to 4 set tabsize 4 set tabstospaces # Automatically indent new lines to match the previous line set autoindent # Enable syntax highlighting for common languages and configs include \u0026#34;/usr/share/nano/*.nanorc\u0026#34; 5. Common Troubleshooting Permission Denied on Save: If you opened a system file without sudo and get a permission error when pressing Ctrl + O, you don\u0026rsquo;t need to lose your work. Save it to /tmp/temp.conf, exit nano, and move it over with sudo mv /tmp/temp.conf /path/to/original.\nWeird Pasting Indentation: Pasting multi-line code from your clipboard can sometimes cause cascading indentation (\u0026ldquo;stair-stepping\u0026rdquo;). Press Alt + I to temporarily toggle autoindent off before pasting, then press Alt + I again afterward.\nAccidental Suspend (Ctrl + Z): If you press Ctrl + Z and drop back to your shell, nano is still running in the background. Type fg and press Enter to bring it right back.\n","permalink":"https://blog.tkrios.xyz/posts/nano-user-guide/","summary":"\u003cp\u003e\u003cstrong\u003eGNU nano\u003c/strong\u003e is a lightweight, terminal-based text editor built into almost every Linux distribution and macOS system. Unlike modal editors like Vim, nano is modeless—you type directly into the file and use \u003ccode\u003eCtrl\u003c/code\u003e or \u003ccode\u003eAlt\u003c/code\u003e key combinations for commands.\u003c/p\u003e\n\u003ch2 id=\"1-opening-and-creating-files\"\u003e1. Opening and Creating Files\u003c/h2\u003e\n\u003cp\u003eLaunch nano from your terminal by passing a filename. If the file doesn\u0026rsquo;t exist, nano creates a new buffer in memory and writes it to disk when you save.\u003c/p\u003e","title":"nano user guide"}]