Before writing the original issue I am facing, I think it'd be best to provide some background.
Background I was trying to register a new source to get packages when running apt-get to finally install azure-iot-sdk-c-dev to use the code to communicate to IoT Hub.
I ran in to issue when tried running the following command.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys xxxxxxxxxxxxxx
From the error it seemed that my PI doesn't have dirmngr directory. So I started looking for solutions. One of the solution was to use the following commands
sudo apt remove gnupg
sudo apt install --reinstall gnupg2
sudo apt install dirmngr
Even though I was informed about the potential damage of the first command I assumed performing the second command would fix things up, but the second command is not running.
Issue It is giving me errors like sudo: apt: command not found to fix that I tried the following
sudo apt-get install --reinstall gnupg2
apt-get update && apt-get upgrade
But both errors out stating -bash: apt-get: command not found