nano editor tutorial.#
Opening and Creating Files:
To open an existing file or create a new one: [1]
nano filename.txt
(Replace filename.txt with your desired file name.) [1]
To open a file with the cursor at a specific line and column:
nano +line_number,column_number filename.txt
Basic Navigation and Editing:
Navigation: Use the arrow keys to move the cursor. Page
Up/Downkeys move a screen at a time.Typing: Begin typing directly after opening the file.
Deleting Characters: Use the
Backspacekey.Deleting a Line: Press
Ctrl+K.Cutting Text: Mark text by pressing
Alt+Aat the start, then move witharrowkeys, and pressCtrl+Kto cut.Copying Text: Mark text as above, then press
Alt+6to copy.Pasting Text: Navigate to the desired location and press
Ctrl+U.Undo/Redo:
Alt+Uto undo,Alt+Rto redo.
Saving and Exiting:
Saving Changes (without exiting): Press
Ctrl+O. You may be prompted to confirm the filename.Exiting (and saving if prompted): Press
Ctrl+X. If changes were made, you’ll be asked to save; pressYforYesorNforNo.
Other Useful Features:
Searching: Press
Ctrl+W, enter your search term, and pressEnter. PressCtrl+Wagain and Enter to find the next occurrence.Replacing: Press
Ctrl+\(orAlt+R), enter the search term, then the replacement term. You can choose to replace all or selectively.Help: Press
Ctrl+Gfor a full list of commands and their shortcuts.
Note: The caret symbol ^ indicates the Ctrl key. For example, ^X means Ctrl+X.