Useful Unix / Mac Commands

See what ports are open

sudo lsof -i -P -n | grep LISTEN

Kill all docker containers

docker container kill $(docker ps -q)

Show all files that contain certain text (in their body, not the filename)

grep ‘Math.PI’ ./* -Rl

this searches for the txt ‘Math.PI’ in all files in this directory (and any child directories), print only the filename (and path) on match

-R recursive

-l show filename