[Terminal] Finding port availability and killing process using it
To find out if there are any processes using a particular port, you should run the following command line:
Then, enter the following cl to kill the process:
Resources:
https://stackoverflow.com/questions/3855127/find-and-kill-process-locking-port-3000-on-mac
lsof -n -i4TCP:<PORT NUMBER>which will give you the following:
Then, enter the following cl to kill the process:
kill -9 <PID>
More Info
lsof:- means list open files
- lists file information about files opened by particular process(es)ers to host names for network files.
- -n option makes the command faster by preventing it from doing an IP to hostname conversion.
- -i[internet address] option selects the listing of files whose internet address matches the internet address.
- Internet address format:
- [4 or 6][protocol][@hostname | hostaddr][:service | port]
- The 4 or 6 refers to IPv4 and IPv6
Resources:
https://stackoverflow.com/questions/3855127/find-and-kill-process-locking-port-3000-on-mac
Comments
Post a Comment