From 2f614ca56103c4d94b4180eb56e02defad22284b Mon Sep 17 00:00:00 2001 From: Rico Ullmann Date: Sun, 24 Apr 2016 14:40:07 +0200 Subject: [PATCH] add nsgrep to find open ports easily --- init.fish | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/init.fish b/init.fish index 0699d20..96ee4ff 100644 --- a/init.fish +++ b/init.fish @@ -42,3 +42,20 @@ function psgrep --description 'show matching processes for $argv' end end + +function nsgrep --description 'show open ports for $argv' + switch (count $argv) + + case 0 + echo -e "No argument given!\nDo you expect me to guess what you're looking for?" + return 1 + + case 1 + netstat -tulpen | grep $1 | grep -v grep + + case \* + echo "Only 1 arguemnt is valid!" + return 1 + + end +end