Archive for the 'Web Servers' Category

Missing PuTTY on your Mac? Use the alias command

Wednesday, October 13th, 2010

If you have moved to Mac OS X from Windows you may be like me and miss the convenience of the saved server settings in PuTTY. These settings allowed you to telnet/ssh into your servers without having to remember the IP of each one. There are numerous ways around this of course, but here is a tip that may come in handy…

Use Alias Shortcuts

The 'alias' command allows you to create an alias, or shortcut, to a longer command. For example you could create a shortcut to open TextEdit from the command line like so:

  • Open the Terminal app
  • Type  the following: 

    alias te='open /Applications/TextEdit.app/'

  • Press Enter
  • Now type "te". TextEdit should open

So how can we use the alias command to replace the convenience of PuTTY and log into servers easily?

We can create shortcuts for servers that we frequently log into. For example in the Terminal type the following:


alias myserver='ssh username@xxx.xxx.xxx.xxx'

Where:

  • myserver = the name of your alias/shortcut
  • username = a valid user on the server
  • xxx.xxx.xxx.xxx = the server IP address

Now you can ssh to that server by simply typing "myserver". This should prompt you for your password – enter that and you're in!

Use .bash_profile to save aliases

At the moment if you close your Terminal, and then re-open it, your aliases will have been forgotten. So how do we tell Terminal to remember them permanently? The trick is to create a .bash_profile file for your Mac user. This file should exist in your Mac home directory. To create this file follow these steps:

  • Open the Terminal app
  • Type the following:

    vi ~/.bash_profile

  • This will open a new blank file in the "vi" editor
  • Press "i" once – this puts the editor into "insert" mode
  • Put your alias command into the file (same as above) – paste using Ctrl+V, or type it
  • Press the Esc key once
  • Type ":wq" to finish editing the file and save it to disk
  • Now close your Terminal app, and reopen it. Your alias should now be working.

Note: If you have TextMate installed (which I highly recommend) then at the command line just type "mate ~/.bash_profile" (instead of using "vi"). This will open a blank file in TextMate. Then type in the alias command as above and save the file. Then close and reopen the Terminal app.

This was just a quick overview for those who can work out the details from the clues above. Even if you do not use aliases to shortcut logging in to servers they are handy to know about.

Happy aliasing!

Website Log Analysis Tools – Which do you prefer?

Thursday, January 5th, 2006

Here is a nice review of some of the current log analysis tools out there. Most of the Linux hosting companies I have worked with offer Webalizer by default. However after having a fresh look at AWStats I would have to agree that it offers superior reports and interface. This feature comparison says it all. From a reporting perspective I personally would like to see AWStats offered by web hosting companies out of the box (over Webalizer). What do you think?

The main reason Webalizer is preferred by hosting companies is because it is extremely fast and thus minimises load when generating reports for multiple websites on a shared server. Any comments on this? How does AWStats compare here?