Search And Replace Text in VI editor

ok, on the example text file above, lets say i want to change all the 'wallpaper' to 'screensaver' well this is how you would do it.. 

lets assume that wallpaperama.txt is located on my home directory at: /home/me/wallpaperama.txt 

step 1. open the file with the vi editor:

vi /home/me/wallpaperama.txt

step 2. Enter – SHIFT + : (the Shift key and the colon key at the same time) on your keyboard, the screen will look like this: 

step 3. now enter this command and hit enter


step 4. now you will see that all the text 'wallpaper' was changed to 'screensaver' 

step 5. save the change with this command:



i hope this helps you 

dpejic has written 84 articles

Leave a Reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>