I have the Azure VM is of Linux (Ubuntu) -20.04.
Long back, installed the apache2 (version is 2.4.41). Now I have tried to uninstall apache2, nginx but when I enter apache2 -v command in the azure vm (putty) - it is still showing me the current version of that server. Why?
Commands I used:
sudo apt remove nginx
sudo apt remove apache2
sudo apt autoremove
apache2 -v
I already uninstalled right but why it is showing me?
Update:
which apache2 command told me the output /usr/sbin/apache2
I tried to delete apache2 from /usr/sbin/ path, it shown me below output:
/sbin$ sudo apt remove apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'apache2' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 281 not upgraded.
If I enter apache2 -v, it shows me the current installed version:
/sbin$ apache2 -v
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2023-03-08T17:32:54
If you see color coding of the output in one of the above screenshot, it shows apache2 color in green color. Green color determines the executable file or recognized data file.
Is that just a executable file which is not installed? Am I Correct?

In my virtual machine I have Apache server like below:
To remove Apache, you can make use of below command:
Output: