I think what you are looking for is:
cleos --url https://eos.greymass.com get actions eosio.ram -1 -20
The above command would give you the last 20 transactions in the account eosio.ram
To consume the result in JSON add --json flag
cleos --url https://eos.greymass.com get actions eosio.ram -1 -20 --json
- For more context regarding
get actions
see EOS Developer Doc here: Exchange Deposit Withdraw