utility to recognise terminal type automatically
