how to list banned IP ubuntu

C++
#list all currently blocked ips:

fail2ban-client status | grep "Jail list:" | sed "s/ //g" | awk '{split($2,a,",");for(i in a) system("fail2ban-client status " a[i])}' | grep "Status\|IP list"

#unban an ip:

fail2ban-client set postfix-mail unbanip 111.222.333.444
Source

Also in C++: