Edit a file

Back in the old days, the geek ‘holy war’ was between the two editors emacs and vi. For some reason I was introduced to vi and after I got the basics down, the only thing I have done was install the improved version, vim.

More recent a new contender entered the market. With Ubuntu straightening the road to Linux for the not so geeky users, there seemed to be a need for a friendlier editor: nano. I have little experience with the editor and still get confused when I edit something on the command line with it.

On Raspberry OS you will have access to both nano and vi by default, as I am more familiar with vi, I will show you this editor, if you prefer nano, be my guest. To me, one of the beauties of Linux is the freedom of choice. To make you navigation a bit more intuitive you might want to use apt to install vim

vi basics

CommandExplanation
vi <filename>Open a file for editing
<arrow keys>navigate through the document
iinsert mode, needed to edit the document
ESCnormal mode
:wwrite
:qexit (after saving or when no changes are made
:q!exit, discarding changes
uundo last change

Leave a Reply

Your email address will not be published. Required fields are marked *