Magento WizardNo joke, this website relaunches on 1st April. New look, new features!

Contact the site  Make Money

Useful SSH Commands for Your Dedicated Server

 Add to Favourites  
(No Ratings Yet)
Loading ... Loading ...

If you host your own web-sites on your own dedicated server, you’ll probably find that Secure Shell (SSH) extremely useful. Using a tool such as Putty, you can manage your server via a utility that looks something similar to a command prompt. Not only is using something like this extremely quick, it also ensures that your precious broadband connection isn’t being used with the transfer of data, and similarly it isn’t so clunky as using web-based solutions like CPanel or Plesk.

However, you do need to be relatively experienced in this field, because Putty gives you direct access to your server, therefore any incorrect key-presses could well cause a few problems!

The server that I am used to configuring uses Apache with FreeBSD, and although some of the commands slightly differ on other platforms (including the file paths), the bulk of them are universal no matter which server you’re SSHing in to. I have provided a list of some of the handy commands below – you might find these useful!

Go to a directory and unzip a file:

cd /usr/local/www/vhosts/domain.co.uk/httpdocs/dirname
tar zxf filename.tar.gz

Deleting mail from a particular mailbox:

find /usr/local/psa/qmail/mailnames/domain.co.uk/mailbox/Maildir/cur -type f -exec rm ‘{}’ \;

Searching the source code within pages:

cd /usr/local/www/vhosts/domain.co.uk/httpdocs/dirname
grep -r “searchtext” *

Viewing the MySQL processes that are running:

mytop -u admin -p`cat /etc/psa/.psa.shadow `

Restarting Apache/MySQL/All Services:

/usr/local/etc/rc.d/apache2.sh restart
/usr/local/etc/rc.d/mysql-server restart
/usr/local/etc/rc.d/psa.sh restart

Copy from one directory to another:

cp -r /usr/local/www/vhosts/source.com/httpdocs /usr/local/www/vhosts/destination.com/httpdocs

Change ownership of files:

cd /usr/local/www/vhosts/domain.co.uk/httpdocs/dirname
chown -R ftpuser:psacln *

I hope you find these useful – more useful tips and tricks for managing your server will almost certainly be added on this blog in the future. If there are any other commands that you think would be handy to share, please leave a comment!

  • Digg
  • del.icio.us
  • Facebook
  • Google
  • LinkedIn
  • Live
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis

about the author

    This article was written by Sam Davis on May 14, 2007.
    Computing over a glass of Grenache Shiraz... again!
    Sam is the Editor of Blasted Thing. Contact Us

related articles

no matches

comments

Leave a Reply




Spam protection by WP Captcha-Free




  • Sponsored Ads

  • Magento Themes
    • vtiger: great article, thank you....
  • Recent Tweets

    #Magento Store Setup and Migration - 2 Stores http://bit.ly/bBA9vu #freelance #jobs #dataentry #dataprocessing #magento #shoppingcarts

    RT @magento: Ecommerce Developer: Building a Magento Theme Start to Finish, Part Ten: The Home Page Home Stretch http://is.gd/aON39

    RT @magento: Ecommerce Developer: Building a Magento Theme Start to Finish, Part Ten: The Home Page Home Stretch http://is.gd/aON39

    #magento Ecommerce Software Reviews: Magento eCommerce Review: Overall, Magento has a lot to offer as an online st... http://bit.ly/bj9PSQ

    #magento Website Templates Blog ยป The Top 5 Open-Source Shopping Carts: At first we have to type up to 5 shopping ... http://bit.ly/9dEryI