Are there scenarios where vi
is the only option to create, edit or modify a file in an Ubuntu environment?
My question is basically to really know if there is such a case where I would be forced to use vi
because it would be the only option available in a particular case in the Ubuntu ecosystem.
Could a particular case exist where I somehow would not have access to other options like nano
, pico
or simply sending the information with tools like cat
, sed
, tee
and more?
I would assume this is more of a server or cloud side since on the Desktop there are many more options, but from anybody that uses the terminal a lot I ask:
Is there such a case?
visudo
can use any editor. Since its default configuration on Ubuntu respects theEDITOR
andVISUAL
environment variables, you can runsudo env VISUAL=emacs visudo
for emacs or evengksudo env VISUAL=gedit visudo
for a graphical editor like Gedit. (sudo -H
orsudo -i
may be used in place ofgksudo
.) I suggest thisenv
way asVISUAL=emacs sudo visudo
won't work (sudo
resets most of the environment) andsudo -EH
might be considered inadvisable.cat
?sed
? Really?vi
really is not that complicated, and if you really cannot be bothered to learn it, you only have to remember two modes (Normal and Insert mode). You move the cursor with arrows (or HJKL if not available), press "i" to start editing (insert mode). Once you are done, press "Esc" to go back to normal mode. Type ":wq" to save and quit (Write + Quit).