Check active ports on Linux
$ sudo netstat -tulpn
Get ordered list
$ sudo touch /usr/bin/check-active-port
$ sudo nano /usr/bin/check-active-port
Paste these into "check-active-port" :
--- --- ---
netstat -tulpn | (read -r h1; read -r h2; echo "$h1"; echo "$h2"; sort -k1,1 -k4,4)
--- --- ---
Then update file permission
$ sudo chmod a+x /usr/bin/check-active-port
Note : if command "netstat" does not available, install by following command bellow.
$ sudo apt install net-tools
Source :
https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/
https://www.tecmint.com/install-netstat-in-linux/

Comments
Post a Comment