Difference between revisions of "Bash aliases"

From PlebNet Wiki
Jump to navigation Jump to search
m
(Marked this version for translation)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<translate>
<!--T:1-->
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.
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.


<!--T:2-->
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.
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.


<!--T:3-->
WORK IN PROGRESS
WORK IN PROGRESS


<!--T:4-->
<syntaxhighlight lang="bash" line>
<syntaxhighlight lang="bash" line>


<!--T:5-->
# linux default bitcoin regtest path
# linux default bitcoin regtest path
alias brdir="cd ~/.bitcoin/regtest"
alias brdir="cd ~/.bitcoin/regtest"


<!--T:6-->
alias bc='bitcoin-cli'
alias bc='bitcoin-cli'
alias bt='bitcoin-cli -testnet'
alias bt='bitcoin-cli -testnet'
Line 15: Line 23:
alias gbinfo='bitcoin-cli getblockchaininfo'
alias gbinfo='bitcoin-cli getblockchaininfo'


<!--T:7-->
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 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 } ]'\'''


<!--T:8-->
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'
<!--T:9-->
</syntaxhighlight>
</syntaxhighlight>


[[File:Change bash_aliases.jpeg|500px]]
<!--T:10-->
[[File:Bash_aliases.jpeg|500px]]
</translate>

Latest revision as of 19:46, 2 October 2021

Other languages:
English

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.

WORK IN PROGRESS

# 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