Elastic Search shows old version

So, you have upgraded/downgraded your elasticsearch in Ubuntu os and now when you check
curl -X get http://localhost:9200
it shows old version instead of the expected version of elastic search. The interesting thing is your elasticsearch service is not running and the package is not installed either.

Solution:
Find out the java process id by running top and kill it. Say your java process id is 2250, then you should run below command.
kill 2250
Make sure you kill all of your java processes.
Reinstall elastic search now.