Editing Files from the Command Line
nano
- Very simple and easy
- to open a file:
nano <file-name> Ctrl + O: Write changesCtrl + K: Cut current lineCtrl + U: Uncut and past at current cursorCtrl + W: Search for keywordCtrl + X: Exit
vi
- Very fast and powerful, but steep learning curve
- open file:
vi <file-name> IGet into Insert-text modeEscGet into Command modeDDdelete lineYYcopy linePPaste clipboard contentsXremove content under cursor:wwrite to disk:q!exit without writing:wq!Save file and quit
Relevant Note(s): Linux Basics