Bash aliases

From PlebNet Wiki
Jump to navigation Jump to search
Other languages:

Bash aliases are used to create shorter versions of more complex commands that would otherwise be too long and tedious to type in. In this case, we see aliases for commands that are focussed on operating a lightning node.

Rather than simply adding all these aliases to your .bash_aliases, consider reading through them carefully, and testing them out first to understand what they do.


# linux default bitcoin regtest path
alias brdir="cd ~/.bitcoin/regtest"

alias bc='bitcoin-cli'
alias bt='bitcoin-cli -testnet'
alias br='bitcoin-cli -regtest'
alias gbinfo='bitcoin-cli getblockchaininfo'

alias lnchannelcaps='lncli describegraph | jq '\''.nodes[].total_channel_capacities=0 | foreach .nodes[] as ( . ; foreach .edges[] as ( . ; if .node1_pub==.pub_key then (|.total_channel_capacities=.total_channel_capacity+(.capacity|tonumber)) else empty end; .) ; .)'\'''
alias lnactive='lncli listchannels | jq '\''[ .channels | .[] | select(.active=true) ] | length '\'''
alias lnchaninfo='lncli listchannels | jq '\''[ .channels | .[] | { "remote_pubkey" : .remote_pubkey, "capacity": .capacity|tonumber, "local_balance": .local_balance|tonumber, "remote_balance": .remote_balance|tonumber } ]'\'''

alias channels='lncli listchannels'
alias channelbalance='lncli channel balance'
alias pendingchannels='lncli pendingchannels'
alias openchannel='lncli openchannel'
alias connect='lncli connect'
alias payinvoice'lncli payinvoice'
alias addinvoie='lncli addinvoice'

Bash aliases.jpeg