# Basic Text Editing (Nano) Nano is a simple, user-friendly text editor for Unix-like operating systems. It's designed to be easy to use, especially for beginners, while still offering powerful features for more advanced users. ## 1. Installation: - On most Linux distributions, Nano is pre-installed. - If not, you can install it using your package manager: - For Ubuntu/Debian: `sudo apt-get install nano` - For Fedora: `sudo dnf install nano` - For macOS (using Homebrew): `brew install nano` ## 2. Basic Usage: - To open Nano: Type `nano` in the terminal. - To open a specific file: `nano filename` - To create a new file: `nano newfilename` ## 3. Interface: - The top line shows the version and file name. - The main area is for text editing. - The bottom two lines show available commands. ## 4. Navigation: - Use arrow keys to move the cursor. - Page Up/Down: Move one screen at a time. - Home/End: Move to start/end of a line. - Alt+/ or Ctrl+_: Move to a specific line number. ## 5. Editing: - Type to insert text at the cursor position. - Backspace: Delete character before cursor. - Delete: Remove character at cursor. - Ctrl+K: Cut the current line. - Ctrl+U: Paste the cut text. - Alt+6: Copy the current line. - Ctrl+^: Mark text (use arrow keys to select). ## 6. File Operations: - Ctrl+O: Save the file. - Ctrl+X: Exit Nano (prompts to save if changes made). - Ctrl+R: Insert another file into the current one. ## 7. Search and Replace: - Ctrl+W: Search for text. - Alt+W: Repeat last search. - Ctrl+\: Search and replace. ## 8. Advanced Features: - Syntax Highlighting: - Enabled by default for many file types. - Customize in `/etc/nanorc` or `~/.nanorc`. - Auto-indentation: - Enable with `-i` option or `set autoindent` in config. - Line Numbers: - Show with `-l` option or `set linenumbers` in config. - Soft Wrapping: - Enable with `-$` option or `set softwrap` in config. ## 9. Configuration: - Global config: `/etc/nanorc` - User config: `~/.nanorc` - Common settings: ``` set autoindent set linenumbers set mouse set tabsize 4 ``` ## 10. Helpful Commands: - Ctrl+G: Display help text. - Alt+X: Enable/disable mouse support. - Alt+N: Enable/disable line numbers. - Ctrl+J: Justify the current paragraph. ## 11. Multiple Buffers: - Ctrl+R: Open a file in a new buffer. - Alt+< and Alt+>: Switch between buffers. ## 12. Macros: - Ctrl+]: Start/stop macro recording. - Ctrl+A: Play back the macro. ## 13. Spell Checking: - Enable with `-s` option or `set speller "aspell -x -c"` in config. - Alt+S: Activate spell checker (if enabled). ## 14. Customizing Shortcuts: - In `.nanorc`, you can bind keys to functions: ``` bind ^Z undo main bind ^Y redo main ``` ## 15. Colored Text: - Use `set titlecolor`, `set statuscolor`, etc. in `.nanorc` to customize colors. Nano is an excellent choice for quick edits and for users who prefer a straightforward, non-modal text editor. While it may not have all the features of more complex editors like Vim or Emacs, its simplicity and ease of use make it a popular choice for many users.