I have a private key. I need to cancel a pending transaction sent from its address.
How to do this from command line?
Also: I need to do the exactly same thing if there are several such pending transactions, don't I?
If you want to speed things up, you can either 'replace' or 'cancel' your original transaction by using the same nonce. Since you have the private key, you can use most common wallets or applications, such as Metamask, MyEtherWallet or MyCrypto who support this. You don't have to do it through the command line.
Re-submit your original transaction with the same nonce and a higher gas price. Check out a 'safe gas price' on ETH Gas watch. This will create a new transaction and will overwrite the first one, once it gets mined.
Create a new transaction, to send 0 ETH to your own address, with the same nonce and a higher gas price. Check out a 'safe gas price' on ETH Gas watch.
This creates a new transaction and prevents previous from being mined, basically canceling the transaction. This is recommended as it is not guaranteed that the second transaction will be mined first and invalidating your first. So you could end up with your original transaction being mined first.