Showing posts with label awk. Show all posts
Showing posts with label awk. Show all posts

Wednesday, July 20, 2016

TIP: kill service on port in macOS

Example: Postgres, which runs on port 5432:

lsof -Pn | awk '/:5432..LISTEN/ {print $2}' | xargs -t kill

Does anyone know if Brew or something has the equivalent of good old Linux fuser -k 5432 ?

Friday, May 30, 2014

devops: per-process swap usage

awk '/Name/{name=$2}; /VmSwap/{printf "%20s\t%s %s\n",name,$2,$3}END{ print ""}' /proc/*/status

inspired from: adnans

Output:
     chromium-browse 19664 kB
     chromium-browse 6128 kB
        avahi-daemon 320 kB
        avahi-daemon 220 kB
              colord 644 kB
                smbd 840 kB