How to locate a Bash environment variable in config files?

Solution Verified - Updated -

Issue

  • Unable to locate where an environment variable is defined.
  • It is time-consuming to search through Bash config files:
    • /etc/environment,
    • /etc/env.d/*
    • /etc/profile
    • /etc/profile.d/*
    • /etc/bashrc
    • /etc/bash.bashrc
    • ~/.bashrc
    • ~/.profile
    • ~/.bash_profile

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content