How to get total number of transactions from bitcoin core wallet using rpc
You can pass the output of listtransactions through a JSON parser which can get that information for you. You can install a command line tool like jq and pipe the output of your commands to it so you can access the JSON fields that you want.