Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add helper to list process running in a given port
Why: ---- Whenever we run a command to use a certain port and we get an error that the port is in use, we have can either: 1. Clear the port so our new process can use it 2. Try and use a new port for the command we just typed In order to make a decision about it, we need information on what is running on that port, so we can determine if we want to stop that process or if it's important enough to keep. What: ---- Two new commands are added to /bin. One to output information about the process using a provided port: ``` bash $ whats-in-port 3000 $ COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME $ ruby 25583 root 11u IPv4 0xee20607697a79bf7 0t0 TCP *:irdmi (LISTEN) ``` This command uses the [lsof] program to get information of the process utilising that port. And another one making use of the previous utility to kill the process running in that port: ``` bash $ clear-port 3000 ``` [lsof]: https://linux.die.net/man/8/lsof Co-authored-by: Mike Burns <[email protected]> Co-authored-by: Edward Loveall <[email protected]>
- Loading branch information