Say I wanted to attach a bitcoin address to a monero transaction in the tx_extra. How can I do this using the CLI wallet? And how does the receiver see this tx_extra data?
The wallets only add specific data to tx extra (e.g. tx public key, payment ID etc) and do not offer options to embed arbitrary data. If you need to add your own arbitrary data, such as your example of embedding a Bitcoin address, you will need to manually construct and broadcast the tx. Of course, embedding something like this will make your tx stick out, which kind of defeats the purpose of using Monero in the first place.