The following rules will allow all outgoing connections, but block any incoming connections. The INPUT and FORWARD chains are set to reject packets by default, the OUTPUT chain is set to accept packets by default, and the last rule allows incoming packets which are part of existing connections (which in this case can only be outgoing connections).
iptables --policy INPUT DROP
iptables --policy FORWARD DROP
iptables --policy OUTPUT ACCEPT
iptables --append INPUT --match state --state ESTABLISHED,RELATED --jump ACCEPT
iptables --append INPUT --jump REJECT
iptables --append FORWARD --jump REJECT
If you want to restrict outgoing traffic you want to change the OUTPUT policy to reject, and add rules to accept traffic on certain ports. For example:
iptables --policy OUTPUT DROP
iptables --append OUTPUT --protocol udp --match multiport --dports domain,bootps --jump ACCEPT
iptables --append OUTPUT --protocol tcp --match multiport --dports domain,http,https,ssh,pop3s,imaps,submission --jump ACCEPT
iptables --append OUTPUT --jump REJECT