Final answer:
You can use the netstat command with the -a option to display both listening and non-listening sockets on your Linux system.
Step-by-step explanation:
To display both listening and non-listening sockets on your Linux system, you can use the netstat command. Netstat is a powerful tool used for displaying network information. The -a option allows you to view all sockets (both listening and non-listening).
Here's an example of the command:
netstat -a
This will provide a list of all sockets along with their status, local address, foreign address, and more.