ostname command shows the name of the system or server you are logged into. Hostname is used to display the system's DNS name, and to display or set its hostname or NIS (Network Information Services) domain name.
Read this post on informaticapoints.com