Short answer:
There is no command in Bitcoin Core to show who mined a specific block, and there likely never will be. You can use it to get the block’s coinbase transaction and see if it contains the miner’s identification (however depending on the method the miner can more or less easily pretend to be another miner).
Long answer:
Miners (and especially mining pools) often identify themselves in the blocks they mine using the coinbase transaction (the first transaction of a block which contains the mining reward). Two fields of the transaction are commonly used:
- Many miners and pools modify the coinbase script (usually called input script or scriptSig in non-coinbase transactions) to include a string tag identifying the pool. For example, the coinbase scripts of today’s largest pools include the tags “Foundry USA Pool”, “Mined by AntPool”, “/ViaBTC/”, and “F2Pool”, respectively. However, nothing stops other miners from including any of these tags as well. I’m not aware of this ever happening nor of any reason why it ever would, but it’s something to keep in mind.
- In case a miner doesn’t identify themselves in the coinbase script or they switch to a new coinbase tag that you don’t yet recognize, you can still try to identify them if they use a static address for paying out the mining reward. Using a new address for every transaction is essential for privacy, but mining pools usually don’t care about that (to the contrary, they often desire to be transparent) so they don’t bother. Pretending to be another miner using this method would require forfeiting the mining reward in favor of the victim miner, so there’s even less reason for anyone to do this, however it’s still possible.
Because miners and pools come and go, and existing ones often change their coinbase tags and payout addresses, someone needs to constantly maintain a list of known miner identifications. One such list is maintained by 0xB10C and is used by many blockchain explorers that show who mined which block. However, online services like these can update their lists in a matter of hours or days, while Bitcoin Core has a release cycle of 6 months, so even the latest version might be unable to identify multiple large pools. That’s one of the reasons this feature will probably never make its way to Bitcoin Core, another one being that it’s just not really in the project’s scope (which is a Bitcoin node and wallet, not an all-purpose blockchain explorer).