On Mon, Mar 15, 2021 at 2:57 PM Gary E. Miller <
gem@rellim.com> wrote:
> Since you're already practicing `which`craft, you could see if lsof is
> available. It's not super uncommon.
And do what with "lsof"?
On my nearest linux machine, here's how I can check what something claiming to be `sshd` is listening on
$ sudo lsof -c sshd | grep LISTEN
sshd 110810 root 3u IPv4 467632368 0t0 TCP *:3 (LISTEN)
sshd 110810 root 4u IPv6 467632370 0t0 TCP *:3 (LISTEN)
sshd 110810 root 5u IPv4 467632372 0t0 TCP *:compressnet (LISTEN)
sshd 110810 root 6u IPv6 467632374 0t0 TCP *:compressnet (LISTEN)
sshd 110810 root 7u IPv4 467632376 0t0 TCP *:ssh (LISTEN)
sshd 110810 root 8u IPv6 467632378 0t0 TCP *:ssh (LISTEN)
And here's how I could find what process is listening on TCP port 22.
$ sudo lsof -iTCP:22 -s TCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 110810 root 7u IPv4 467632376 0t0 TCP *:ssh (LISTEN)
sshd 110810 root 8u IPv6 467632378 0t0 TCP *:ssh (LISTEN)
And here's what process has claimed port 22 on my mac:
% sudo lsof -iTCP:22 -s TCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
launchd 1 root 7u IPv6 0x9ec2fde432ea81b7 0t0 TCP *:ssh (LISTEN)
launchd 1 root 8u IPv4 0x9ec2fde432eb010f 0t0 TCP *:ssh (LISTEN)
launchd 1 root 10u IPv6 0x9ec2fde432ea81b7 0t0 TCP *:ssh (LISTEN)
launchd 1 root 11u IPv4 0x9ec2fde432eb010f 0t0 TCP *:ssh (LISTEN)
Yep, launchd is doing that systemd thing.
--
GDB has a 'break' feature; why doesn't it have 'fix' too?