Ubuntu / Linux news and application reviews.

Firstly, to see what ports are opened, use the following command:
nmap localhost
or:
nmap <my_ip>
and replace "my_ip" with your IP.

The above command will give an output of something like this:

nmap localhost

Then, to close a port, simply run the following command:
fuser -k <port>/tcp
Obviously, replacing "port" with the port you would like to close. So for instance, if you want to close port 80 (HTTP), you would run the following command:
fuser -k 80/tcp