Skip to content

Instantly share code, notes, and snippets.

@micrub
Last active October 6, 2021 01:34
Show Gist options
  • Save micrub/f5c1e806ef7c3a2ee723348a8e1ae93f to your computer and use it in GitHub Desktop.
Save micrub/f5c1e806ef7c3a2ee723348a8e1ae93f to your computer and use it in GitHub Desktop.

Revisions

  1. micrub revised this gist Oct 6, 2021. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions macos-aliases-listening.md
    Original file line number Diff line number Diff line change
    @@ -5,4 +5,10 @@ stole from [how-can-i-list-my-open-network-ports-with-netstat](https://apple.sta

    ```
    netstat -Watnlv | grep LISTEN | awk '{"ps -o comm= -p " $9 | getline procname;colred="\033[01;31m";colclr="\033[0m"; print colred "proto: " colclr $1 colred " | addr.port: " colclr $4 colred " | pid: " colclr $9 colred " | name: " colclr procname; }' | column -t -s "|"
    ```

    # quote wrapped for usage as an alias in zsh

    ```
    alias listening="netstat -Watnlv | grep LISTEN | awk '{\"ps -o comm= -p \" \$9 | getline procname;colred=\"\033[01;31m\";colclr=\"\033[0m\"; print colred \"proto: \" colclr \$1 colred \" | addr.port: \" colclr \$4 colred \" | pid: \" colclr \$9 colred \" | name: \" colclr procname; }' | column -t -s \"|\""
    ```
  2. micrub revised this gist Oct 6, 2021. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion macos-aliases-listening.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,8 @@
    # base

    stole from [how-can-i-list-my-open-network-ports-with-netstat](https://apple.stackexchange.com/questions/117644/how-can-i-list-my-open-network-ports-with-netstat)
    `netstat -Watnlv | grep LISTEN | awk '{"ps -o comm= -p " $9 | getline procname;colred="\033[01;31m";colclr="\033[0m"; print colred "proto: " colclr $1 colred " | addr.port: " colclr $4 colred " | pid: " colclr $9 colred " | name: " colclr procname; }' | column -t -s "|"`


    ```
    netstat -Watnlv | grep LISTEN | awk '{"ps -o comm= -p " $9 | getline procname;colred="\033[01;31m";colclr="\033[0m"; print colred "proto: " colclr $1 colred " | addr.port: " colclr $4 colred " | pid: " colclr $9 colred " | name: " colclr procname; }' | column -t -s "|"
    ```
  3. micrub revised this gist Oct 6, 2021. 2 changed files with 4 additions and 1 deletion.
    4 changes: 4 additions & 0 deletions macos-aliases-listening.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # base

    stole from [how-can-i-list-my-open-network-ports-with-netstat](https://apple.stackexchange.com/questions/117644/how-can-i-list-my-open-network-ports-with-netstat)
    `netstat -Watnlv | grep LISTEN | awk '{"ps -o comm= -p " $9 | getline procname;colred="\033[01;31m";colclr="\033[0m"; print colred "proto: " colclr $1 colred " | addr.port: " colclr $4 colred " | pid: " colclr $9 colred " | name: " colclr procname; }' | column -t -s "|"`
    1 change: 0 additions & 1 deletion macos-aliases-listening.zsh
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    netstat -Watnlv | grep LISTEN | awk '{"ps -o comm= -p " $9 | getline procname;colred="\033[01;31m";colclr="\033[0m"; print colred "proto: " colclr $1 colred " | addr.port: " colclr $4 colred " | pid: " colclr $9 colred " | name: " colclr procname; }' | column -t -s "|"
  4. micrub renamed this gist Oct 6, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. micrub created this gist Oct 6, 2021.
    1 change: 1 addition & 0 deletions macos-aliases.zsh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    netstat -Watnlv | grep LISTEN | awk '{"ps -o comm= -p " $9 | getline procname;colred="\033[01;31m";colclr="\033[0m"; print colred "proto: " colclr $1 colred " | addr.port: " colclr $4 colred " | pid: " colclr $9 colred " | name: " colclr procname; }' | column -t -s "|"