# fail2ban command

##### 常用指令表

- [Commands - Fail2ban](https://www.fail2ban.org/wiki/index.php/Commands)

<table border="1" cellpadding="1" cellspacing="1" id="bkmrk-cmd-description-serv" style="width: 90%; table-layout: fixed;"><tbody><tr><td>Cmd</td><td>Description</td></tr><tr><td>service fail2ban restart

systemctl restart fail2ban

</td><td>restart fail2ban service (after edit configuration)</td></tr><tr><td>fail2ban-client reload</td><td>restart fail2ban client</td></tr><tr><td>fail2ban-client status</td><td>get list activated jail</td></tr><tr><td>fail2ban-client status &lt;JAIL&gt;  
example: fail2ban-client status wplogin  
example: fail2ban-client status sshd</td><td>get &lt;JAIL&gt; status (the number of unsuccessful attempts and the list of banned IPs)</td></tr><tr><td>fail2ban-regex /var/lib/docker/containers/&lt;CONTAINERID&gt;/&lt;CONTAINERID&gt;-json.log /etc/fail2ban/filter.d/wplogin.conf</td><td>test regex wplogin</td></tr><tr><td>fail2ban-regex /var/log/auth.log /etc/fail2ban/filter.d/sshd.conf</td><td>test regex sshd</td></tr><tr><td>fail2ban-regex "line" "failregex"</td><td>test regex</td></tr><tr><td>fail2ban-client set &lt;JAIL-NAME&gt; unbanip &lt;IP-ADDRESS&gt;</td><td>manually unban IP</td></tr><tr><td>fail2ban-client set &lt;JAIL-NAME&gt; banip &lt;IP-ADDRESS&gt;</td><td>manually Ban IP</td></tr><tr><td>tail -f /var/log/fail2ban.log</td><td>view fail2ban logs</td></tr><tr><td>iptables -L –line-numbers</td><td>list IP blocked with line numbers</td></tr><tr><td>iptables -D &lt;Jail-Name&gt; -s &lt;IP-ADDRESS&gt; -j DROP  
Example: Jail-Name =f2b-wplogin  
Jail-Name =f2b-sshd</td><td>Unban IP</td></tr><tr><td>fail2ban-server -b</td><td>start fail2ban server</td></tr><tr><td>docker inspect –format='{{.LogPath}}' $INSTANCE\_ID</td><td>return instance log file path</td></tr><tr><td>fail2ban-client get &lt;JAIL-NAME&gt; ignoreip  
</td><td>Test ignoreip for JAIL  
</td></tr></tbody></table>

Check the version

```bash
fail2ban-client version
```

Check the Help

```bash
fail2ban-client -h
```