What file defines the global environment variables for all users?

Prepare for the LPIC-2 Certification Test with our study tools, including flashcards and multiple choice questions with hints and explanations. Get ready to pass your exam!

The file that defines the global environment variables for all users is /etc/environment. This file is specifically designed to set up system-wide environment variables that are applied to all users at login. It is a simple key-value pair format without shell syntax, making it distinct from scripts that might include conditional statements or commands.

In addition, /etc/profile serves as a startup file for login shells, where it can configure user environments by invoking other initialization scripts and setting environment variables. However, it is not solely dedicated to defining global environment variables the way /etc/environment is.

While ~/.bashrc is intended for individual user configurations and is executed for non-login interactive shells, it does not impact other users' environments. Similarly, /usr/local/etc/profile would typically be related to specific software or user configurations rather than being a standard global environment configuration file.

Thus, /etc/environment serves the specific and crucial role of defining the environment for all users on a system, ensuring consistent access to necessary variables globally across user sessions.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy