Select Page

If you can remember all the cryptic commands within the Vi text editor on Linux then you are some kind of genius. For us mere mortals, the quickest way to edit files on Linux is to bin off Vi and move over to Nano. There, I said it, get over it. Nano is better than Vi hands down. 

But in the unfortunate event you need to do a bit of Vi work before you can move over to Nano, for example to configure a network configuration file or to configure a Yum repositories configuration file for example, then you need to know how to work with Vi so you can get through that painful process as quick as possible. 

Here are some handy Vi commands;

  • Open a file: vi filename.txt
  • Edit the file – aka. go into ‘insert mode’: Press the letter ‘i’ once you have opened the file
  • Change what ever you need to do as usual
  • Exit from Insert Mode: Press ESC
  • Prepare to exit the file: Press colon :
  • Now save and exit the file: Press, wq, then enter
  • Whoops I messed up: Within Vi there are so many commands that seem to just utterly break the editor unless you know what they do that is can be difficult to exit out of the thing. If in doubt press ESC or CTRL + Q or CTRL + C and you should get back to where you need. Then exit the file without saving by pressing, :, q!, enter

I mean, simple, right?!?! Anyhow, that’s how you quickly edit the files you need and recover from when Vi has gone a bit crazy. 

 

The following two tabs change content below.

Michael Cropper

Founder & Managing Director at Contrado Digital Ltd
Michael has been running Contrado Digital for over 10 years and has over 15 years experience working across the full range of disciplines including IT, Tech, Software Development, Digital Marketing, Analytics, SaaS, Startups, Organisational and Systems Thinking, DevOps, Project Management, Multi-Cloud, Digital and Technology Innovation and always with a business and commercial focus. He has a wealth of experience working with national and multi-national brands in a wide range of industries, across a wide range of specialisms, helping them achieve awesome results. Digital transformation, performance and collaboration are at the heart of everything Michael does.