Utility to recognise terminal type automatically
