Posted by: SEO Positive

Posted on: May 26, 2010 7:46 am


So we’re all used to using Dream Weaver, Notepad++, Zend Studio whatever floats your boat. But you have an important change that you just don’t want to open one of these cumbersome programs to open, because you know it will take literally a few seconds, misplaced semi-colon or an equal’s sign where there shouldn’t be one.

The answer is Command Line! Command line is your best friend as a web developer, here at SEO Positive we use it all the time for fixes on new clients sites and existing sites and for editing important hidden files such as  [dot] files, there are a few you can choose from but my favourite is vim as it provides fantastic source colouring for most files.

Linux/Unix based operating system’s have these small programs built into them and if you’re using a Windows machine you will need access to a Linux or Unix based system and to use PuTTY to access the command line if you have appropriate access to it.

once you have logged into your command line window you’ll probably be thinking, well what now?

its very simple, at SEO Positive we use a mix of vi, vim and nano. But what are these I hear you saying, they are editors based on the command line.

You need to find the location of your desired file and type the following into your command prompt window depending on what editor you have chosen.

sudo vim /location/to/your/file

You will then be asked for a password, if you’re on a web server you may not need to prefix this line with ‘sudo’ as this is a command that tells the system you want to perform an action as the computers administrator.

You will then be presented with the source of your file. I’ve written a short list of the keyboard short cuts for vim and some links to a full list of short cuts for the other two previously mentioned editors.

^ = shift

^E = skip the current word
^A = edit the end of the current line
a = edit the current line at the current cursor position
esc = exit edit mode (file remains open)
^W = save changes (write changes)
^ZZ = save current changes and exit vim (closes file and vim)

And the links to other resources:

VIM Shortcuts

VI Shortcuts

NANO Shortcuts