Don’t know where I picked this one up, but here is a tip for today.
I totally heart vi, I can’t deny it. Knowing how to manipulate can sometimes be tricky, and nobody says it has an easy learning curve. Maybe somebody will find this useful:
To find a particular line in vi you could first press / and then type in what you are looking for. And poof, you go to that line. Press ‘n’ and you will keep going. But sometimes I want to go straight to a line but don’t quite know what it is. For that…
# grep php -n httpd.conf
26:LoadModule php5_module modules/libphp5.so
137: DirectoryIndex index.html index.php
382:AddType application/x-httpd-php .php .phtml
Now you know the lines of whatever you are looking for. Now open up vi, press : and then enter the number, e.g.
:382
Press enter and you are there. Yay.

Leave a Reply