can i prevent a malware to connect on my pc simply setting ''incoming traffic to deny'' and allowing only outgoing traffic? I red that a malware could use the port knoking tecnique, but with a GUI firewall i should notice of this attack simply seeing the changed rules on the firewall. Isn it?
Common malware exploits certain bugs and flaws inside vulnerable services which typically listen to tcp ports or udp datagrams from the network. If your machine has no listening ports at all or your firewall (I assume iptables) configuration is set to block any input activity, then you're protected from attacks against servers.
But if your client programs such as web browser, email client etc. have vulnerabilities like wrong image processing, buffer overflows etc. it is still possible that you will get attacked and arbitrary code still will be executed. So it depends.
And in Unix world, no one gets easy to read notices about attacks in gui windows, there usually command line tools tell what is going on.
This question is worth asking at information security stack exchange.