October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Find What’s Using a Port on Linux: A Practical ss, lsof, and ps Workflow

Identify a Linux socket, map it to a PID, and inspect its command safely with ss, lsof, and ps.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To find the process behind a Linux port, start with ss to identify the socket, use lsof to cross-check it or get its PID, then inspect that PID with ps. Check the protocol, listening state, local address, and command before taking action: a port listing alone does not establish that a service is safe to stop or reachable from outside the host.

1. Check which socket is listening with ss

For a TCP listener on port 8080, run:

sudo ss -ltnp 'sport = :8080'

  • -l shows listening sockets.
  • -t selects TCP sockets.
  • -n keeps addresses and port numbers numeric.
  • -p requests process information.
  • sport = :8080 filters for the local source port.

sudo may reveal process details that your user cannot see, but use it only when you are authorized to inspect the system. Check man ss for the options and filter syntax supported by the installed version.

As an Amazon Associate I earn from qualifying purchases.

For UDP, query UDP sockets rather than assuming a TCP lookup covers them. If you are looking for a connection that is not listening, remove the listening-only condition and choose the socket state and protocol relevant to your question. “Using a port” can mean a listener or another kind of socket.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Cross-check the port or get its PID with lsof

lsof reports open files, including network sockets. To see readable details for Internet sockets using port 8080, run:

sudo lsof -nP -i :8080

Here, -i :8080 selects Internet sockets by port, while -nP avoids resolving hostnames and converting port numbers to service names. For PID-only output, use:

lsof -t -i :8080

The -t option requests terse output containing process identifiers. Use man lsof to check the installed version’s port-filtering details and options.

3. Inspect the process behind a PID with ps

Once a socket lookup gives you a PID, substitute it for 1234 here:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

ps -p 1234 -o pid,user,args

This displays the PID, owning user, and visible command arguments. ps provides process context; it does not identify which process owns a socket by itself. Command arguments can help identify an application, but they are not always a complete description of how a service is managed. Check man ps for local field and option details.

4. Interpret the result before changing anything

Compare the protocol and socket state with the question you are trying to answer, then check the local address, PID, and process command. The bind address affects reachability: a loopback-only listener is limited to the host’s loopback interface, whereas a wildcard bind can listen on multiple local interfaces. A port number by itself does not tell you whether remote machines can connect; network and firewall configuration also matter.

Do not terminate a process just because it appears in the listing. First identify the owning application or service and decide whether stopping it is appropriate. If it needs to be stopped, prefer the service manager or the application’s normal shutdown procedure over terminating it blindly.

5. If the commands show no result

An empty result is a clue to investigate, not conclusive proof that no process owns the port. Check these possibilities:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Protocol: The socket may be UDP rather than TCP, or vice versa.
  • State: You may be filtering for listeners when the socket is established or in another state.
  • Filter: Verify the port and command syntax, and consult the installed man page.
  • Permissions: The current user may not be able to see process details. The lsof manual describes access warnings and errors; authorized elevated privileges may change what is visible.
  • Namespace or container: The command may be running in a different network namespace from the socket you are investigating. Check from the relevant host, container, or namespace.
  • Timing: A short-lived socket may disappear between checks.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Which command should you use first?

Command Best role in this workflow Useful detail
ss Socket-first inspection Can filter by protocol, state, and port, and request process information.
lsof Open-file and socket cross-check Can select Internet sockets by port; -t requests PID-only output.
ps Process inspection after finding a PID Shows selected process fields, such as PID, user, and arguments; does not perform the socket lookup.

These commands provide complementary views rather than interchangeable guarantees. Results depend on permissions, timing, and the system or namespace being inspected. The examples are for Linux; distributions may ship different versions or options, so check man ss, man lsof, and man ps on the machine you are using.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.