Equivalent Linux Commands In MacOS

Even though I’ve been using MacOS for a while, there are certain things that I just still remember doing in Linux. Probably it got burned into my mind when I was under pressure to debug something in work. Whatever the reason, I can never remember how to do similar in MacOS.

So I’m noting them down here.

Listing Open TCP Ports

Equivalent to netstat -nap:

lsof -nP -i4TCP:$PORT | grep LISTEN

Managing Daemons

The tool to manage running services and daemons is launchctl. The Linux equivalent would be systemctl and the various init.d scripts.

launchctl stop com.openssh.sshd

Shell Cheatsheet