All About Web Hosting

A repository for all kinds of useful web hosting information

A couple handy command line (SSH) tips

leave a comment »

Just a quick bit that may be helpful to someone out there… If you have a linux-based web hosting plan and SSH access, you have a very powerful tool at your command! We’re talking many times more useful than simple FTP.

For example, say you need to update your site, but you’re not sure which files have the bit of text you need. Let’s say it’s an out of date copyright line in a footer – try this:

grep -rl ‘copy 2007” *

Which will list all files that have that “copy 2007″ text in them, in all directories from the current one on down. Or perhaps you need to securely copy a lot of files from one website to another. Of course you could downlod them all from site1 to your local machine, then upload them all to site2… But isn’t that kind of a waste when you could directly from site1 to site2? Heck, the internet connections between the two servers are probably faster than your local connection also. Try using scp to copy files. This command will recurisvely (i.e. get all the subdirectories) copy from site1 to site2:

scp -r ./* site@site.com:~/site2/path/to/desination/

It’s as easy as that! Don’t let the fact that these commands seem arcane or complicated, there’s tons of other examples out there on the web – just do some googling!

Written by web hosting guy

September 30, 2008 at 5:41 pm

Posted in Uncategorized

Tagged with

Leave a Reply