Check out example codes for "rails kill server". It will help you in understanding the concepts better.

Code Example 1

kill -9 $(lsof -i tcp:3000 -t)

Code Example 2

lsof -wni tcp:3000
kill -9 PID

Learn ReactJs, React Native from akashmittal.com