What's listening on port 8080
Today, while experimenting with
CockroachDB I noticed that a process
was already listening on TCP port 8080. I used netstat — which I had
to install first — to discover which process was listening on port
8080.
The fact that I had to install netstat on Ubuntu 19.04 led me to
conclude that there was an alternative command to get the same
information, and indeed: ss, another utility to investigate sockets
according to its man page.
In the evening I used
ss -lptn
to find the names of all TCP listening processes.
The options I used (combined) are:
- -l, --listening: Display only listening sockets.
- -p, --processes: Show process using socket.
- -t, --tcp: Display TCP sockets.
- -n, --numeric: Do not try to resolve service names.
Regarding the latter, this shows 8080 instead of http-alt for port
8080.
Since I wanted to keep that process listening on port 8080 running I
had to find an alternative port for CockroachDB, which can be
specified with the --http-addr option as follows:
cockroach start \
    --certs-dir=$CERTS \
    --listen-addr=localhost \
    --http-addr=localhost:8200