Where does Aristotle or St. Thomas Aquinas say we know substances by means of their accidents?
For example: To know the substance of an apple, I first have to sense its quantity and qualities: shape, color, size, weight, etc.
Probably the best quote, Posteriora Analytica l. 13 n. 7:
…quia formæ essentiales non sunt nobis per se notæ, oportet quod manifestentur per aliqua accidentia, quæ sunt signa illius formæ, ut patet in VIII Metaphys. Non autem oportet accipere accidentia propria illius speciei, quia talia oportet per definitionem speciei demonstrari; sed oportet notificari formam speciei per aliqua accidentia communiora; et secundum hoc differentiæ assumptæ dicuntur quidem substantiales, in quantum inducuntur ad declarandum formam essentialem, sunt autem communiores specie, in quantum assumuntur ex aliquibus signis, quæ consequuntur superiora genera.
…because the essential forms are not known to us per se, they must be disclosed through certain accidents which are signs of that form, as is stated in Metaphysics VIII [1042b9-1043a28: "Form Inferred from Accidental Differences in Sensible Substances"]. However, one should not take the proper accidens of that species, because they are the ones that will be demonstrated by the definition of the species; rather the form of the species must be made known by certain accidents that are more common. Hence according to this, the differences which are used are indeed called substantial, inasmuch as they are adduced in order to declare the essential form; but they are more common than the species, inasmuch as they are taken from signs which follow upon higher genera.
In rebus enim sensibilibus etiam ipsæ differentiæ essentiales nobis ignotæ sunt, unde significantur per differentias accidentales, quæ ex essentialibus oriuntur, sicut causa significatur per suum effectuum
For even in the case of sensible things, the essential differences themselves are not known; whence they are signified through accidental differences which rise out of the essential ones, as a cause is signified through its effect
De Spirit. Creaturis, a. 11, ad 3:
Formæ substantiales per seipsas sunt ignotæ; sed innotescunt nobis per accidentia propria. Frequenter enim differentiæ substantiales ab accidentibus sumunutr, loco formarum substantialum quæ per huiusmodi accidentia innotescunt; sicut bipes et gressibile et hujusmodi; et sic etiam sensibile et rationale ponuntur differentiæ substantiales. Vel potest dici, quod sensibile et rationale, prout sunt differentiæ, non sumuntur a ratione et a sensu secundum quod nominant potentias, sed ab anima rationali, et ab anima sensitiva.
because substantial forms in themselves are unknown but become known to us by their proper accidents, substantial differences are frequently taken from accidents instead of from the substantial forms which become known through such accidents; as, for example, "biped" and "able to walk" and the like; and so also "sensible" and "rational" are put down as substantial differences. Or it may be said that "sensible" and "rational", insofar as they are differences, are not derived from reason and sense according as these are names of powers, but from the rational soul and from the sentient soul.
ST I, 29, 1, ad 3
quia substantiales differentiæ non sunt nobis notæ, vel etiam nominatæ non sunt, oportet interdum uti differentiis accidentalibus loco substantialium, puta si quis diceret, ignis est corpus simplex, calidum et siccum, accidentia enim propria sunt effectus formarum substantialium, et manifestant eas. Et similiter nomina intentionum possunt accipi ad definiendum res, secundum quod accipiuntur pro aliquibus nominibus rerum quæ non sunt posita. Et sic hoc nomen individuum ponitur in definitione personæ, ad designandum modum subsistendi qui competit substantiis particularibus.
Substantial differences being unknown to us, or at least unnamed by us, it is sometimes necessary to use accidental differences in the place of substantial; as, for example, we may say that fire is a simple, hot, and dry body: for proper accidents are the effects of substantial forms, and make them known. Likewise, terms expressive of intention can be used in defining realities if used to signify things which are unnamed. And so the term "individual" is placed in the definition of person to signify the mode of subsistence which belongs to particular substances.
rerum essentiæ sunt nobis ignotæ
the essences of things are not known to us
In de anima lib. 1 l. 1 n. 15:
Quia in definitione oportet non solum cognoscere principia essentialia, sed etiam accidentalia. Si enim recte definirentur et possent cognosci principia essentialia, definitio non indigeret accidentibus. Sed quia principia essentialia rerum sunt nobis ignota, ideo oportet quod utamur differentiis accidentalibus in designatione essentialium: bipes enim non est essentiale, sed ponitur in designatione essentialis.
…because a definition ought to reveal a thing’s accidental qualities, as well as its essential principles. If indeed the latter could be known and correctly defined, there would be no need to define the former; but since the essential principles of things are hidden from us, we are compelled to make use of accidental differences as indications of what is essential. Thus to be two-footed is not of the essence of anything, yet it helps to indicate an essence.
nomen dicitur ab aliquo imponi dupliciter: aut ex parte imponentis nomen, aut ex parte rei cui imponitur. Ex parte autem rei nomen dicitur ab illo imponi per quod completur ratio rei quam nomen significat; et hoc est differentia specifica illius rei. Et hoc est quod principaliter significatur per nomen. Sed quia differentiæ essentiales sunt nobis ignotæ, quandoque utimur accidentibus vel effectibus loco earum, ut VIII Metaph. dicitur; et secundum hoc nominamus rem; et sic illud quod loco differentiæ essentialis sumitur, est a quo imponitur nomen ex parte imponentis, sicut lapis imponitur ab effectu, qui est lædere pedem. Et hoc non oportet esse principaliter significatum per nomen, sed illud loco cuius hoc ponitur. Similiter dico, quod nomen verbi imponitur a verberatione vel a boatu ex parte imponentis, non ex parte rei.
A name is derived from two sources: from the one who uses the word or from the thing to which it has been applied. A word is said to be derived from a thing in so far as it signifies that by which the notion of the thing is completed, that is, the thing’s specific difference; and this is what a word principally signifies. But, since we do not know essential differences, sometimes, as is said in the Metaphysics [VIII], we use accidents or effects in their place, and name a thing accordingly. Hence, in so far as something other than the essential difference of a thing is used as the source of a word, the word is said to be derived from the one who uses it. An example of this is the word lapis (stone) which is derived from its effect, lædere pedem (to bruise the foot). Now, this effect should not be taken as that which the word principally signifies, but merely as that which takes the place of what is signified. Similarly, verbum (word) is derived from verberatio (a disturbing) or from boatus (shout) because of those who use it—not because of the thing it signifies.
sed cognitio nostra est adeo debilis quod nullus philosophus potuit unquam perfecte investigare naturam unius muscæ.
But our manner of knowing is so weak that no philosopher could perfectly investigate the nature of even one little fly.
(courtesy Ens Primum Cognitum in Thomas Aquinas and the Tradition p. 162n45)
I don't think he says this in the Metaphysics, but he does say (De Anima iii, 7) that "the soul understands nothing without a phantasm." Thomas famously discusses this in Summa I q. 84 a. 6.
A 'phantasm' is broadly what 20th century philosophers used to call a 'sense datum', i.e. data directly present to sense which capture the accidental attributes of a substance.