Archive for June, 2009

Move files from one directory into another without affecting the existing directory using mac terminal

As part of using mac terminal more and more in my own day to day work, I today needed to be able to move all the files and folder from a directory back one directory in the main http folder on my server.

I needed to move all of the files from a file that I unzipped straight to the server, which unfortunately also created another subfolder called PhpEx in my http directory.

So I want to copy of the files and folders from /sites/dunelink.com/http/PhpEx back a directory to /sites/dunelink.com/http

This is how I did it:

mv /sites/dunelink.com/http/PhpEx/* /sites/dunelink.com/http

Notice the * this denotes move everything within the folder but not the actual folder. This will also leave the existing folder untouched exactly where it already is.

If you wish you can then delete the PhpEx folder and all its files with one simple command.

rm -rf /sites/dunelink.com/http/PhpEx

Hope this helps

Simple Essential Subversion Commands

As we are now using subversion here at Bytewire I thought it might be useful to just blog a few of the essential commands.

svn status  – Will show you all the files you have changed pending a commit

svn status -u – Will show you all the files that are pending to update on the repository

svn update  – Wil update your files with the files from the repository that have changed.

svn commit -m ‘message’  – Will update the repository and commit your pending files, with a message to describe what you have commited.

svn add ‘filename or foldername’ – cd into the directory of your site and then add ‘http/filename.php’ or http/foldername/ this will update the repository with a new file.

svn rm ‘file or foldername’ – Will remove a file or directory.

svn mv ‘file or filename’ – Used to edit or move a filename so svn mv hello.php hello2.php will move the file hello.php to hello2.php

These are all of the essential commands.

I will be posting more to this list in the coming weeks.

How to tunnel a mysql connection to your remote server

Today I spent alot of the day sorting our development techniques to bring a best practise into what we do. We needed to both be able to connect to the same remote database but both be able to develop locally. So we decided to setup ssh tunnels to our mysql server.

You can quite simply open a ssh tunnel with your server using the following:

ssh -L 3307:domain.name.of.mysqlserver:3306 username@domain.name.of.gatewayserver

You can then connect to the server with php using the following,

DB_USER – root – DB_HOST – 127.0.0.1 :3307 – DB_NAME – db_name DB_PASS – root pass

Download a file / folder using mac terminal and curl

Simply use the following command:

curl -O http://www.yoursite.com/backup/mybackup.tar.gz

Will simply download the file to your local machine and your current location.

To change the current location on your local machine firstly you can find out where you are by hittng ‘ls’ which will list all possible directories and files. Then you can cd into whichever the directory is that you want to end up in.

For example ‘cd Desktop/Backups/’

Then when you run the command it will end up in your current location. If you mess up or want to move that file at a later date you can use the following command:

‘mv  myfile.tar.gz   newlocation’

Hopefully this helps someone.

How to create a tar gzip backup of your websites files and folders mac terminal

Simply use the following command:

Firstly cd into the directory you want the backup to go into so cd /sites/backups/

tar cvfz backupname.tar.gz /sites/yoursite.com/http

This will create a backup up of your entire site and put it into the current folder you are in.

You can see the backup in the folder after running the command simply by “ls”

How to remove a entire directory, files and sub directories using mac terminal

Terminal Mac

Simply use the following command:

rm -rf /sites/yoursite/http2

This will force remove all files and folders under the toplevel folder you specified so be warned!

You can also use rm -ri which will prompt you at every folder and file.

At the prompts simply enter ‘n’ for no and ‘y’ for yes.

Where can I find websites that are for sale?

Untill a few weeks back I was pretty lost in terms of looking for a decent site to browse websites that go for sale, how much they go for and the general concepts that seem to be flying off the shelves.

That was untill I was shown sitepoint, sitepoints site is simple and pretty good. I now end up checking it almost everyday for interesting new sites that go for sale.

Its pretty entertaining especially for me as a business owner and a web designer.

So check it out here Sitepoint Marketplace and see what you think.

If you know of anymore that I dont add them to this list so that I can check them out.

How to move your domain name to another server

This is a very short post about how to move your domain name if you really dont have a clue.

What you’ll need

Youll need to ask the persons or person hosting your new server which you want to move the domain name too.  For the nameservers that they use. You might not know what these are but they will most certainly and are easily obtainable.

Secondly youll need to find your control panel logins for where you have registered your domain name.

Thirdly youll need to ask your domain registrar or current hosts to reduce your domains TTL which stands for “Time To Load” this is the industry standard method of controlling how long it will take for your domain to propogate or change from its current records. It is standard industry practise to acknowledge the TTL. You may not know what this is but your hosts most definitely will. If you get the TTL reduced before you move the domain then it will make the actual domain propogation quicker.

What you need to do

Simply login to your registrars control panel for managing your domains, locate the domain name you want to move to another server then find the option to update dns records!

Once you have located it, youll notice it will probably ask for nameserver1 & nameserver2 – simply enter the nameservers given to you by your new host.

The last step

Finally to complete the movement to your new server make sure you let your new hosts know that you pointed your domain at there nameservers so that they can accept the domains.

After this you should be ready to set the domains up on your new hosting control panel or ask your new hosts to do it for you.

Simple as that.

Search Engine Optimisation – The Basics – Lesson 1

After doing some pretty intense search engine optimisation over the last few months myself and to some great success I feel its time to share some of my knowledge with others. Over the next couple of articles I will be providing some truly comprehensive tips to help search engine optimise your website!

Lesson 1

KEYWORD ANALYSIS

First step to understand the nature of keywords that drive traffic to the website.

Keyword analysis allows us to have a range of keywords to engage in search engine optimization for.

Know the level of competition for those specific keywords. This will help estimate how difficult/how much time will be required to rank tops for certain keywords.

The number of times the keywords are searched for monthly. This allows us to project the number of visitors we can expect to our site with a successful SEO campaign

The cost per click (CPC) for each keyword. This gives an idea of how cost-effective the SEO campaign will be.
For example, if a keyword costs $1 per click. It means if we are able to rank high for that keyword, every visitor that comes to us from the search we save $1 in CPC cost.
This helps you value SEO.

TOOL USED FOR KEYWORD ANALYSIS

We use the Google keyword tool.
https://adwords.google.com/select/KeywordToolExternal

It provides us with comprehensive information regarding, keywords, keyword popularity, keyword competition, CPC.

Have a little play with that tool and then check back in for lesson 2. I would suggest starting with a list of 10 keywords/phrases that you would like to try and rank highly for. Id also suggest picking these keywords before you even start to develop your website it is much easier to build a site withthe keywords identified in mind all the way through than go back and try and make the site reflect the keywords you want it too!

End of Lesson 1