Why

I am often in need of my current VPN IP address especially while doing CTFs.

I first solve my issue by creating an alias that I can call anytime

alias vpnip='echo $(ifconfig tun0 | grep "inet " | cut -b 9- | cut  -d" " -f2)'

but I found myself typing that alias too often that I thought that having this information visually available would be more convenient.

How to

First let’s move our vpnip alias to a script

Now let’s follow the steps

On this screen, we can select our script

Here is the online and polished version

and while “not online”, there is not going to be any information to show like below

Troubleshoot

We might have the following

To solve that, we need to make our script executable