I have changed the configuration directory for bitcoind.

However when I make a bitcion-cli request:

bitcoin-cli getblockcount

I get an error about RPC credentials using ~/.bitcoin/bitcoin/conf

So for me to actually run the command with the correct config and authnetication cookie I have to specify the configuration directory explicitly every time. Is there a way to make it implicit?

bitcoin-cli -conf=/media/btc/bitcoin/bitcoin.conf getblockcount

1 Answer 1


In this case I would create an alias?

$ alias BCLI="bitcoin-cli -conf=/media/btc/bitcoin/bitcoin.conf"
$ BCLI getblockcount

On Windows you may use doskey.

  • 2
    It's also common practice to use the same name when using alias for setting default options: alias bitcoin-cli="bitcoin-cli -conf.... If one ever wants to call the non-alias command, it's just a matter of prefixing the command name with a backslash to prevent alias expansion: $ \bitcoin-cli ...
    – JoL
    Jan 4, 2021 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.