Skip to content

Instantly share code, notes, and snippets.

@kknd22
Last active July 16, 2019 12:30
Show Gist options
  • Save kknd22/2556f9d1c6c97ad36a126667dda4d6c6 to your computer and use it in GitHub Desktop.
Save kknd22/2556f9d1c6c97ad36a126667dda4d6c6 to your computer and use it in GitHub Desktop.
linux-bash-network.sh
# https://www.binarytides.com/linux-ss-command/
# https://www.computerhope.com/unix/nc.htm
# show only the listening sockets (To get the output faster, use the "n" option to prevent ss from resolving ip addresses to hostnames)
ss -ltpn
ss -ltn
# test the connetion (netcat)
# "r" means report not connect
nc -rv <host> <port>
#### seee your own ip address
curl icanhazip.com
#### see your own ip address (filter out 127.x and 172.
ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'| grep -v '172.'
##############
https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/
sudo lsof -i -P -n | grep LISTEN
sudo netstat -tulpn | grep LISTEN
sudo nmap -sTU -O IP-address-Here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment