kill all localhost lports inux code example Example 1: kill a port kill $(lsof -ti:3000) Example 2: kill port sudo kill -9 $(sudo lsof -t -i:8080)