A very good configuration that in fact uses GUFW is hardly installed on a PC, it is to deny all incoming traffic and allow outgoing traffic.
We can adjust this with the following commands:
For this, we use the option allow and we specify the port to which we want to allow the incoming traffic and the TCP protocol that it uses:
We could apply this by writing something like:
Suppose we have a default rule in which all incoming traffic is allowed (NOT recommended), but we want to deny incoming traffic only in a certain port, we could apply that configuration with something like:
In case you want to disable UFW, type the command: