---
title: "TIL: Finding Processes on a Port With lsof -i"
description: lsof -i :PORT shows which process is holding a port. End the 'what is already running on 3000' guessing game for good.
canonical: https://lukeocodes.dev/til-lsof-listening-ports
type: article
locale: en_GB
published: 2025-12-02T00:00:00.000Z
modified: 2025-12-02T00:00:00.000Z
authors:
  - Luke Oliff
section: TIL
tags:
  - TIL
  - Engineering
feed: https://lukeocodes.dev/rss.xml
search: https://lukeocodes.dev/search.json?q={query}
schema:
  - "@context": https://schema.org
    "@graph":
      - "@type": Organization
        "@id": https://ably.com/#organization
        name: Ably
        url: https://ably.com
      - "@type": WebSite
        "@id": https://lukeocodes.dev/#website
        url: https://lukeocodes.dev
        name: Luke Oliff
        alternateName: lukeocodes
        inLanguage: en
        publisher:
          "@id": https://lukeocodes.dev/authors/luke#person
        description: Personal blog and writing by Luke Oliff — developer relations, voice AI, developer experience.
        potentialAction:
          - "@type": SearchAction
            target:
              "@type": EntryPoint
              urlTemplate: https://lukeocodes.dev/blog/search?q={search_term_string}
            query-input: required name=search_term_string
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Staff engineer and Staff Tech Lead for Developer Experience at Ably. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Staff Tech Lead, Developer Experience
        worksFor:
          "@id": https://ably.com/#organization
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
  - "@context": https://schema.org
    "@graph":
      - "@type": Organization
        "@id": https://ably.com/#organization
        name: Ably
        url: https://ably.com
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Staff engineer and Staff Tech Lead for Developer Experience at Ably. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Staff Tech Lead, Developer Experience
        worksFor:
          "@id": https://ably.com/#organization
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
      - "@type": BlogPosting
        "@id": https://lukeocodes.dev/til-lsof-listening-ports#article
        headline: "TIL: Finding Processes on a Port With lsof -i"
        alternativeHeadline: "TIL: Finding Processes on a Port With lsof -i"
        description: lsof -i :PORT shows which process is holding a port. End the 'what is already running on 3000' guessing game for good.
        datePublished: 2025-12-02T00:00:00.000Z
        dateModified: 2025-12-02T00:00:00.000Z
        url: https://lukeocodes.dev/til-lsof-listening-ports
        mainEntityOfPage: https://lukeocodes.dev/til-lsof-listening-ports
        inLanguage: en
        author:
          - "@id": https://lukeocodes.dev/authors/luke#person
        isPartOf:
          "@id": https://lukeocodes.dev/#website
        keywords: TIL, Engineering
        articleSection: TIL
        abstract: Port 3000 is already in use. The error message does not tell you by who. lsof does.
        speakable:
          "@type": SpeakableSpecification
          cssSelector:
            - .post-tldr
            - h1
        image: https://lukeocodes.dev/og.png?h=TIL%3A+Finding+Processes+on+a+Port+With+lsof+-i&d=lsof+-i+%3APORT+shows+which+process+is+holding+a+port.+End+the+%27what+is+already+running+on+3000%27+guessing+game+for+good.&e=Writing
        wordCount: 149
        timeRequired: PT1M
        publisher:
          "@id": https://ably.com/#organization
      - "@type": BreadcrumbList
        itemListElement:
          - "@type": ListItem
            position: 1
            name: Home
            item: https://lukeocodes.dev
          - "@type": ListItem
            position: 2
            name: Writing
            item: https://lukeocodes.dev/blog
          - "@type": ListItem
            position: 3
            name: "TIL: Finding Processes on a Port With lsof -i"
            item: https://lukeocodes.dev/til-lsof-listening-ports
---

[Luke Oliff.](/)

- [Blog](/blog)
- [CV](/cv)
- [Uses](/uses)
- [User manual](/user-manual)
- [Living with ADHD](/living-and-working-with-adhd)
- [RSS](/rss.xml)

[Luke Oliff · Writing](/blog)

# TIL: Finding Processes on a Port With lsof -i

Dec 2025 · [TIL](/blog/category/til) · 1 min read · [Luke Oliff](/authors/luke)

Port 3000 is already in use. The error message does not tell you by who. lsof does.

```bash
lsof -i :3000
```

Shows every process using port 3000. The output includes the PID, process name, and connection state.

```bash
lsof -i TCP:3000
```

Filter to TCP connections only. UDP filtering works the same way.

```bash
lsof -i :3000 | grep LISTEN
```

Find only the process that is listening on the port, not connections to it.

```bash
kill -9 $(lsof -t -i :3000)
```

The -t flag outputs PIDs only. Combine with kill to shut down whatever is holding the port without looking at the output.

### What port ranges can I query?

Any port number from 1 to 65535. lsof shows both IPv4 and IPv6 listeners.

### Does lsof require sudo?

Some processes are owned by other users. Run sudo lsof to see every process on every port.

[← Newer: TIL: Chaining Shell Commands With && vs ; vs ||](/til-shell-chaining-operators)

[All posts](/blog) →

## Search this site

`GET https://lukeocodes.dev/search.json?q=<words>` returns matching posts as JSON, each with its page URL and its markdown URL. Add `&limit=<1-50>` for more than 10. How it works: [/blog/search](https://lukeocodes.dev/blog/search.md).

```sh
curl "https://lukeocodes.dev/search.json?q=developer+relations"
```

---

© 2026 Luke Oliff. Posts live at the root of this site.

- [GitHub](https://github.com/lukeocodes)
- [LinkedIn](https://www.linkedin.com/in/lukeocodes)
- [X](https://x.com/lukeocodes)
- [Bluesky](https://bsky.app/profile/lukeocodes.dev)
- [Email](mailto:luke@lukeoliff.com)
- [RSS](/rss.xml)

## Cookies

This site sets one analytics cookie, from Google Analytics, and only in a browser that accepts the cookie banner. A client that does not run scripts sets no cookies, so there is nothing to accept or decline here.

[Cookie policy](/cookies)
