What file would you typically modify to change system-wide environment variables?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

To change system-wide environment variables, modifying the /etc/environment file is a common practice. This file is specifically designed to set environment variables for all users on the system. The syntax used in /etc/environment is straightforward: it consists of variable assignments in the form of "VARIABLE=value". This file is read by the system during the login process and applies globally, ensuring all users have access to the defined environment variables.

While /etc/profile is also a valid choice for setting system-wide environment variables, it is primarily used for defining login and shell variables for users who start a new shell session. Changes made to /etc/profile will only be applied upon the initialization of a shell, hence it may not affect all services or applications immediately and could necessitate a new login.

The /etc/bashrc file, on the other hand, is intended for setting variables and functions specifically for interactive non-login and login shells based on the Bash shell. It does not serve as a general-purpose environment configuration file.

Lastly, the ~/.bash_profile file is user-specific and affects only the individual user's shell environment, rather than being system-wide. This makes it unsuitable for modifying variables that should apply universally across all users of the system.

In conclusion, for setting global environment variables accessible

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy