I have a question, I have installed Ubuntu 14.04 and on this machine is icinga software. when I opened the terminal and typed:
sudo vi /etc/icinga/objects/localhost.cfgthen the terminal opened the file, but I can't type in this file. When I type "d" then the terminal delete everything in the file.
53 Answers
vi = too hard to use for a new user
nano = text editor that is run from the terminal like vi, only it's much easier to use for 2 reasons:
- The instructions for using nano editor are always found at the bottom of every page.
- The only two nano keyboard shortcuts that you need to know are for WriteOut and Exit. Press the keyboard combination Ctrl+O and after that press Enter to save the file being edited. Press the keyboard combination Ctrl+X to exit nano.
nano is installed by default in Ubuntu.
Tip - Make the terminal easier to read. In the terminal select Edit -> Profile Preferences -> Colors tab and change the Background color to black and the Text color to white.
vi or vim is an advanced editor. So I will suggest you to get familiar with it before using it.
For now:
If you want to edit a file using terminal, press
ito go intoinsertmode.Edit your file and press ESC and then
:wto save changes and:qto quit.
However, you can combine these two like :wq to write and quit the vim editor.
If you want to learn how to use
vim editor, use vimtutor command, which starts the Vim tutor. You can also use gksu gedit /etc/icinga/objects/localhost.cfg to open it in gedit and work from there, if you are having trouble using vi.
But G_P is right, type man vi in the terminal and it should give you all the instructions.