1

I am trying to program a server software which involves a lot of testing on java / scala platform. Whenever i compile and execute the code. It starts listening on port 80. Sometimes i need to terminate it by Ctrl+C when it hangs. In that case, ubuntu is not freeing the port. So in order to run the process, i have to restart the machine.

I see this at ps aux

root      1924  0.0  0.0   5796  1660 pts/0    T    05:44   0:00 sudo scala -
root      1925  0.2  1.5 491448 40796 pts/0    Tl   05:44   0:03 java -Xmx256M -Xms16M

So process 1924 and 1925. I did sudo kill on both these. But then they keep on persisting even after a long time.

sudo nmap -T Aggressive -A -v 127.0.0.1 -p 1-65000

Scanning localhost (127.0.0.1) [65000 ports]

Discovered open port 80/tcp on 127.0.0.1

It means its still there !

sudo netstat --tcp --udp --listening --program

tcp6       0      0 [::]:www                [::]:*                  LISTEN      1925/java
tcp6       0      0 ip6-localhost:ipp       [::]:*                  LISTEN      1185/cupsd

This means its 1925 - java

How to kill it.

1 Answers1

2

kill -9 sends a SIGKILL which allows you to kill any process that isn't waiting on IO.

A regular kill just sends SIGTERM which only asks the process to quit. Whereas SIGKILL tells the OS to immediately terminate the process.

MikeyB
  • 39,291
  • 10
  • 105
  • 189