Listing open ports/services

Seeing what services are open on your ports on your system is a useful tool for system administrators, becaues of this most linux flavours have a built in system to check, a tool called lsof. Below is a list of what all of the headers within the command mean in the context of networking

Header Description
Command Lists the running service by its name
PID The process ID of the service
User Which user on the system is running that service
FD File Descriptor - What permissions the process has
Type What type of service is running
Device & Size/Off The disk file size in use
Node The traffic type in use
Name The devices name as well as it's listen status

More information can be found on the use of lsof by using the following command;

man lsof

Before carrying out any commands please make sure you are logged into a privileged or superuser account.


Showing all services on open ports

lsof -i

Searching for services on a specific port

lsof -I :PORT

Closing a process by port

kill $(lsof -t -i:PORT)

Closing a process by PID

kill PID

Still need help? Open a support ticket

Got any questions? Contact us today.