Skip to content

Latest commit

 

History

History
103 lines (76 loc) · 2.48 KB

command-line.md

File metadata and controls

103 lines (76 loc) · 2.48 KB
title parent grand_parent nav_exclude has_toc layout
Pimp the CLI
+ System
Bonus Section
true
false
title description tableOfContents outline pagination
visible
true
visible
visible
true
visible
true
visible
true

Pimp the command line

In this section, we are going to do instructions for changing the prompt "$" symbol to the Bitcoin symbol "₿" and color and install bash completion scripts for Bitcoin Core and Lightning projects command CLI instructions.

{% hint style="success" %} Difficulty: Easy {% endhint %}

Command prompt

You can prettify your command prompt for each user by enabling color output and setting a custom prompt

  • With user admin, open and edit .bashrc as shown below. Save and exit
nano /home/admin/.bashrc --linenumbers
  • Uncomment line 46
force_color_prompt=yes
  • Comment the existing line 60 (backup)
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  • Add the next line (in line 61)
PS1="${debian_chroot:+($debian_chroot)}\[\e[33m\]\u@\h\[\033[01;34m\]\w\[\e[33m\] ₿\[\e[m\] "
  • Insert the following at the end of the file
alias ls='ls -la --color=always'

  • Apply changes
source /home/admin/.bashrc

Bash completion

  • As user admin, install bash completion scripts for Bitcoin Core and LND. You then can complete partial commands by pressing the Tab key (e.g. bitcoin-cli getblockch [Tab] → bitcoin-cli getblockchaininfo)
cd /tmp/
wget https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/completions/bash/bitcoind.bash

{% code overflow="wrap" %}

wget https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/completions/bash/bitcoin-cli.bash

{% endcode %}

{% code overflow="wrap" %}

wget https://raw.githubusercontent.com/lightningnetwork/lnd/master/contrib/lncli.bash-completion

{% endcode %}

{% code overflow="wrap" %}

sudo mv bitcoind.bash bitcoin-cli.bash lncli.bash-completion /etc/bash_completion.d/

{% endcode %}

{% hint style="info" %} Bash completion will be enabled after your next login {% endhint %}