Back

Professional Hosting Shell Updates

8 August 2009

34SP.com Staff

Many of you are now using our new Professional Hosting package and have over the past few months requested extra features be added to the shell environment provided with this package as standard.

With these requests in hand, over the weekend a number of new features have been added to the shell that should please a number of users.

First is the introduction of a .bash_profile file (emtpy as standard) in the main root directory, this file enables you to setup some things to happen when you first login to your shell – the main reason we added this is that you may want to use it in conjunction with the newly added mysql/mysqldump commands (see below for more information), in this file you can add simple things like aliases to common commands that you use regularly.

There is one other blank file that you may find of use and this in the .ssh directory and called authorized_keys. This file is for you to add your public rsa keys and will enable you to have passwordless access to the shell system. A program such as puttygen on windows can be used to create a private/public key pair for the use of this feature. All unix variants will have there own commands such as ssh-keygen, while this can be used for passwordless shell access it also has the same affect on scp/sftp/rsync as well – so can prove very useful if you want to automate synchronization between your own machine and the servers using these types of commands.

The tools that have been added are listed below with a brief description of what they are and some notes on things that could be useful.

nano – This is an a small text editor and is much easier to use for most peoples needs than vi, the standard editor in the shell. Documentation on the nano editor can be found at http://www.nano-editor.org/dist/v2.1/nano.html however there is enough on screen information to get you started using this editor.

unzip/gunzip – these have been added so that you can now uncompress files without the need to contact us to do this for you.

tar – this enables you to create/extract tar archive files from the shell

zcat – enables you to view a compressed file without the need to uncompress beforehand

gzip – this enables you to compress a file easily from the shell

svn – (subversion client) a number of users have asked for this type of functionality in the system, so that they can ‘checkout’ projects etc without the need to download and reupload them, more details regarding subversion can be found at http://subversion.tigris.org/
Please note you may need to add the following to the .bash_profile to overcome a warning message about language settings
export LC_ALL=C

find – Lost a file on your webspace? This makes it easy to find – a simple command such as find / -name ‘file.name’ will search all your directories for the file named ‘file.name’, you can also use find to do very complex commands like chmodding files that match specific names or access patterns.

mysql/mysqldump – these have been the most requested by our users that wish to manipulate their databases directly from the shell. The implementation of mysql does require the use of the -h (host) parameter, to connect to your database on the server you would need to use mysql -h 127.0.0.1 -u USER -p DBNAME similary with mysqldump. This is where the aliases in the .bash_profile can come in useful – add a line in it similar to this
alias mysql=’mysql -h 127.0.0.1 -u USERNAME -p DBNAME’
And then disconnect and reconnect to your shell, the next time you type ‘mysql’ on its own you will be prompted for the database password and on entry you would have access to your database easily. If you have more than one database you would need to create extra aliases for all the other databases with slightly different alias names.

The same procedure can be used to make backups using mysqldump easier if you wish too.

If anyone has any other suggestions for tools please do let us know, we cannot guarantee we will add them but we will look into them for you or try to offer alternative methods to achieve the same result. Be sure to look to 34SP.com if you need UK domain names or UK hosting as well.