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>
I
Get into Insert-text modeEsc
Get into Command modeDD
delete lineYY
copy lineP
Paste clipboard contentsX
remove content under cursor:w
write to disk:q!
exit without writing:wq!
Save file and quit
Relevant Note(s): Linux Basics