Which configuration file is commonly used to set system-wide environment variables?

Study for the Linux Fundamentals Test. Enhance your skills with flashcards and multiple-choice questions. Each question has hints and explanations. Get ready for your exam!

The configuration file commonly used to set system-wide environment variables is /etc/environment. This file is specifically designed to define environment variables that will be available to all users and processes on the system. When the system boots up, /etc/environment is read, and the variables defined within it are set for the entire session, ensuring a consistent environment across all users.

This file has a simple format where each line typically contains a key-value pair, and it does not execute commands or scripts like some other shell configuration files do. This is ideal for defining static environment variables such as PATH, LANG, or any other global configuration that should remain consistent regardless of the user or the shell being used.

The other files mentioned in the options have different purposes or scopes. For example, /etc/profile is used for system-wide configurations for login shells in bash, but it is more about initializing the shell environment than setting environment variables directly. /home/user/.bashrc is user-specific, meant for individual user configurations in bash sessions, and does not apply system-wide. The file /usr/local/etc/environment is not a standard location for environment variables and is not typically used in most Linux distributions.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy