Skip to content

Instantly share code, notes, and snippets.

@nullx5
Last active December 29, 2025 07:25
Show Gist options
  • Select an option

  • Save nullx5/4c886c3e7af947c6c277fefaa5b7af86 to your computer and use it in GitHub Desktop.

Select an option

Save nullx5/4c886c3e7af947c6c277fefaa5b7af86 to your computer and use it in GitHub Desktop.

logs ss y lsof

ss

#!/usr/bin/bash

while true; do                                                                       
  sudo ss -tunp
  sleep 2
done | ts '[%Y-%m-%d %H:%M:%S]' | sudo tee -a /var/log/ss-logs.log > /dev/null
sudo chmod u+x ss-logs.sh
./ss-logs.sh &
sudo tail -f /var/log/ss-logs.log
image

lsof

#!/usr/bin/bash

while true; do                                                                       
  sudo sudo lsof -i :22 -i :53 -i :80 -i :443
  sleep 2
done | ts '[%Y-%m-%d %H:%M:%S]' | sudo tee -a /var/log/lsof-logs.log > /dev/null
sudo chmod u+x lsof-logs.sh
./lsof-logs.sh &
sudo tail -f /var/log/lsof-logs.log
image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment