Vim can be hard to use at the beginning, but when you’re used to it and know a few tricks, it’s impossible to go back to nano, also known as ‘the text editor for kids’.

You need, for instance, replace all the occurrences of the ip by in a configuration file :

1 – Open your file with vim

vi /etc/service/configuration.conf

2 –  Type the following (don’t forget to stat with “:”) :


What the command exactly did ? %s is of substitution and g for global, meaning you will replace all the occurrences.

But what if you configuration file contains ?

With the previous example, will become and that’s not what we want !

To avoid partial match you have to execute the following :


The command will replace only and not because we searched for the full word only.