Linguistics is the scientific study of language: how it is spoken, written, communicated, interpreted, what it means and how it comes to be in the first place.
Akkadians around 2500 BCE were writing lists of Sumerian nouns to preserve that prestige language. Linguists in ancient India recorded grammars, pronunciations and wordlists to correctly recite the many sacred Vedic texts. Similar to the Indian traditions, Chinese philology came about to understand classic texts of the Han dynasty, reconstructing older Chinese languages and varieties. Romans noticed many similarities between their Latin and the concurrent Greek spoken at the time.
The Middle Ages saw further distinctions between ‘fields’ of language study. In response to Arabic becoming a lingua franca across the Islamic world, almost a hundred years of grammarian work culminated in the monumental Al-kitab fi al-nahw (The Book on Grammar), collected and written by Persian linguist Sibāwayhi. The Irish Sanas Cormaic (lit. Cormac's Advice) was written, becoming Europe's first etymological and encyclopaedic dictionary in any non-Classical language linguists know of today. Philosophy on universal grammar by the Modistae (or Speculative Grammarians), and the origin of language and speculation on philosophical languages by Jesuits bloomed during the Renaissance and Baroque periods.
Though impressive in depth and rigour, these practices still don't exactly fit the modern, standardised sense of linguistics – everyone still had various outlooks on how to record language, how to analyse it and why we should in the first place. The Babel myth, for example, had been taken by a notable number of scholars as truth, some stating all languages descended from Hebrew, Latin, or even Irish.
Modern linguistics, as with much of recent world history, has been heavily influenced by European practice. Jean‑François Champollion uncovered the Rosetta Stone and greatly contributed to the decipherment of Egyptian Hieroglyphs. Philologist Jacob Grimm, with the help of an enormous collection of sources from many grammarians such as Rasmus Rask, produced Deutsche Grammatik, a large piece on German and Germanic languages' grammar and histories. Sir William Jones is often accredited to bringing the idea of an Indo-European family to the forefront of linguistics (then mostly known as philology), though many others before him such as Marcus Zuerius van Boxhorn, Leibniz, William Wotton and Gaston-Laurent Coeurdoux had already produced sophisticated insights onto the common origin of languages in Europe and sometimes beyond.