There is a right way and a wrong way to do this, if you want the removal to survive reboots and not be overwritten by updates, use the code below:
# create config file
echo "net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee /etc/sysctl.d/99-my-disable-ipv6.conf
# ask the system to reload it
sudo service procps reload
# check the result
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
The result should come back with a “1”.
the ifconfig command should now also show only IPv4 addresses