Magento Wizard
Latest Stories: 

Write articles for us and make money!  Make Money

Useful SSH Commands for Your Dedicated Server

 Add to Favourites   Email This Post Email This Post
 Very handy...  This Blog WASN\'TThis Blog WAS
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 encourages you to make money by writing articles for us! Learn More

related articles

no matches

comments

Leave a Reply






    Magento Hosting
    Magento Themes
    Just wanted to say that Inline translating is the best thing ever. I love magento....
  • Sponsored Ads

  • The New Blasted Thing

    Blasted Thing has recently undergone an essential re-design, as we prepare to welcome a host of new features in to our web-site.

    We will continue to be gathering useful articles, tutorials and advice regarding Magento - and we'll be focusing on a number of hosting and theme companies which we have independently verified.

  • Translate this page

    Translate