Skip to content

Instantly share code, notes, and snippets.

@FourSeventy
Last active February 24, 2019 20:05
Show Gist options
  • Save FourSeventy/05720c99f74b3905a8f37ac5dd6543b1 to your computer and use it in GitHub Desktop.
Save FourSeventy/05720c99f74b3905a8f37ac5dd6543b1 to your computer and use it in GitHub Desktop.
Useful Commands
# netcat port scanning
nc -zv host-name port-range
sudo nc -zv -w 2 10.150.0.3 1-1023
#find out what process is using what port
lsof -i :port
sudo lsof -i :80
#list what ports a process is using
lsof -Pan -p PID -i
sudo lsof -Pan -p 13107 -i
#list what connections a process has open
sudo lsof -i -a -p $PID
#list all ports that are currently listening on a box
netstat -an | grep "LISTEN "
#postgres backup
sudo bash -c 'pg_dump --dbname=postgresql://user:password@localhost:5432/database_name > ~/backups/backup_`date +\%d\%m\%y`.sql'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment