Rails error - Address already in Use - Lessons Learned 7

When I tried to start rails server $rails s

I was getting following error.

Address already in use - bind(2) for "127.0.0.1" port 3000 (Errno::EADDRINUSE)

This meant that the process was running already.

How I fixed it?

$ lsof -wni tcp:3000
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
ruby    55037 uday   15u  IPv4 359795      0t0  TCP 127.0.0.1:3000 (LISTEN)
ruby    55037 uday   16u  IPv6 359796      0t0  TCP [::1]:3000 (LISTEN)
$ kill -9 55037  # 55037 is the process id.
$ lsof -wni tcp:3000
$ rails s
Rating: