Skip to content

Linux & shell: Network

5 Linux & shell commands: Network. Click a command to see what each part does.

Index
5 items
Click a command to see what each part does.

Network5

  • ss -tulpnWhich process listens on which port

    What each part does

    1. sssocket statistics (modern netstat)
    2. -tTCP sockets
    3. -uUDP sockets
    4. -llistening sockets only
    5. -pshow the owning process (needs sudo for other users’ processes)
    6. -nnumeric ports and addresses, no name lookups
  • sudo lsof -i :<port>Who is using a port

    What each part does

    1. lsoflist open files (sockets are files too)
    2. -ionly network sockets
    3. :<port>filter to that port
  • ip -br addr; ip routeInterfaces and routes

    What each part does

    1. ip -br addrevery interface with its addresses, one line each (-br = brief)
    2. ip routerouting table, including the default gateway
  • curl -sS -o /dev/null -w "%{http_code} %{time_total}s\n" <url>Check an HTTP endpoint: status code and time

    What each part does

    1. -ssilent: no progress bar
    2. -Sbut still show errors
    3. -o /dev/nullthrow away the response body
    4. -w "…"print a custom line after the request: %{http_code} = status, %{time_total} = seconds
  • curl -fsSL <url> -o <file>Download a file, following redirects, failing on HTTP errors

    What each part does

    1. -ffail (non-zero exit, no output) on HTTP 4xx/5xx
    2. -s -Squiet, but show errors
    3. -Lfollow redirects
    4. -o <file>write the body to <file>

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…