On current Linux distributions, `ss` is the recommended tool for this:
ss -tuw
This will show TCP (`-t`), UDP (`-u`) and raw (`-w`) sockets. Add `-a` to also see listening sockets ( _i.e._ sockets waiting to receive an incoming connection request, or open for incoming traffic in the case of UDP). Add `-r` to attempt to resolve addresses and service numbers.