Skip to content

check

portcheck check

Check whether ports are free and show who holds them

Synopsis

Check whether local ports are free. For ports in use, show the owning process.

Exit status is 0 when every port is free and 1 when any port is in use or cannot be bound, which makes 'check' handy in scripts:

portcheck check 5432 || echo "postgres port is taken"

portcheck check <port>... [flags]

Examples

  portcheck check 3000
  portcheck check 3000 8080 5432
  portcheck check 8000-8010 --json
  portcheck 3000                  # shortcut

Options

  -h, --help           help for check
      --proto string   protocol: tcp or udp (default "tcp")

Options inherited from parent commands

      --json                shorthand for --output json
      --log-format string   log format: text or json (default "text")
      --no-color            disable colors (also honors NO_COLOR)
  -o, --output string       output format: table, plain, csv, json (default: table on a terminal, plain otherwise)
  -v, --verbose             log diagnostic details to stderr

SEE ALSO

  • portcheck - See what's using your ports, find free ones, and free them up