How to permanently unset a environment variable

I was trying to set up cloudflare warp but uninstalled it due to the number of issues it was causing, now my https_proxy variable will not unset, I can unset it for a single session with unset but it keeps coming back. I have checked my .profile and .bashrc but cannot find anything

Have you logged out and back in again?

Something like grep -rs http_proxy /etc or other directories where config artifacts could be left

Yes, when I rebooted this morning, the variable seemed to be absent. But only time will tell if it has been properly unset.

Actually, this is possibly a better syntax –

 # LANG=C grep -Ri 'https_proxy' /etc/*
Binary file /etc/alternatives/jre/lib/server/classes_nocoops.jsa matches
Binary file /etc/alternatives/jre/lib/server/classes.jsa matches
Binary file /etc/alternatives/jre/lib/modules matches
Binary file /etc/alternatives/jre_openjdk/lib/server/classes_nocoops.jsa matches
Binary file /etc/alternatives/jre_openjdk/lib/server/classes.jsa matches
Binary file /etc/alternatives/jre_openjdk/lib/modules matches
Binary file /etc/alternatives/go matches
Binary file /etc/alternatives/jre_21/lib/server/classes_nocoops.jsa matches
Binary file /etc/alternatives/jre_21/lib/server/classes.jsa matches
Binary file /etc/alternatives/jre_21/lib/modules matches
Binary file /etc/alternatives/ftp matches
/etc/profile.d/profile.csh:    case HTTPS_PROXY=*:
/etc/profile.d/profile.csh:     setenv https_proxy "${val:q}"
/etc/profile.d/profile.csh:     unsetenv http_proxy https_proxy ftp_proxy gopher_proxy no_proxy socks_proxy SOCKS_PROXY SOCKS5_SERVER
/etc/profile.d/profile.sh:      HTTPS_PROXY=*)
/etc/profile.d/profile.sh:          https_proxy="${val}"
/etc/profile.d/profile.sh:          export https_proxy
/etc/profile.d/profile.sh:    unset http_proxy https_proxy ftp_proxy gopher_proxy no_proxy NO_PROXY socks_proxy SOCKS_PROXY SOCKS5_SERVER
/etc/sysconfig/proxy:HTTPS_PROXY=""
/etc/wgetrc:#https_proxy = http://proxy.yoyodyne.com:18023/
/etc/xdg/kioslaverc:httpsProxy=HTTPS_PROXY
 #

Please note the need to use a user with administrator privileges – not everything in the ‘/etc/’ directory tree is other/world-readable …

I assume it should not be set at all. And that is what you probably achieved.

If you just removed the setting and stayed logged in, opening a new terminal will inherit the environment from the parent process, as I recall (ie, the GUI session itself).

Logging out and back in is the only way to effectively remove it from that parent environment.

@dcurtisfra

grep -Ri 'https_proxy' /etc/*

* and -i (in this case) are redundant
(q was about ‘https_proxy’ variable, register matters)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.