Ahoy is a term used to shout between ships, usually as a greeting or to attract attention. It is derived from the Middle English word 'HOY' which means 'HEY'. The term is also used in other contexts, such as when someone is trying to get someone else's attention.