Setting system wide shell options

From Linux Bash Shell Scripting Tutorial Wiki
Jump to navigation Jump to search

← Setting shell optionsHomeChapter 3 Challenges →

  • By default /etc/profile file act as a system-wide profile file for the Bash shell.
  • You can force setting using this file for all user. However, it is recommended that you use /etc/profile.d file under CentOS / Fedora / Redhat Enterprise Linux. For all other distribution edit /etc/profile file.
  • Task: Setting up a JAVA_HOME and PATH settings for all user.
    • Create /etc/profile.d/ file, enter:
export JAVA_HOME=/opt/jdk1.5.0_12
export PATH=$PATH:$JAVA_HOME/bin

Save and close the file. Setup executable permission:

chmod +x /etc/profile.d/

← Setting shell optionsHomeChapter 3 Challenges →