Skip to content

Instantly share code, notes, and snippets.

@sergepetit
sergepetit / loopback_aliases.sh
Created October 25, 2013 12:39
It is sometimes convenient to have several distinct ip addresses pointing to your loopback. By default in OSX, you only have 127.0.0.1 in ip v4. You can add aliases with ifconfig.
#!/bin/bash
#use -alias do remove an entry
ifconfig lo0 alias 127.0.1.1
ifconfig lo0 alias 127.0.1.2
ifconfig lo0 alias 127.0.1.3
ifconfig lo0 alias 127.0.1.4
@sergepetit
sergepetit / tips_lsof.sh
Last active May 12, 2022 12:39
Shell command lsof : see open files and ports; Selection is OR by default, use -a for AND; Tested on OSX
#List all ports for tcp
sudo lsof -itcp
#all ports for tcp, dont resolve port name from numbers
sudo lsof -itcp -P
#open files and ports of process #$PID
sudo lsof -p $PID
#only ports of tcp for process #$PID, dont resolve port name, dont resolve ip name