AlpineLinux 3.8: /etc/profile.d and ~/.profile configuration

This article will describe a configuration about /etc/profile.d and ~/.profile.

1 /etc/profile.d

/etc/profile will load *.sh script at the /etc/profile.d. The commands to be shared to all user should be written to *.sh script at the /etc/profile.d.

1.1 Fix /etc/profile.d/color_prompt

Because this script does not have *.sh suffix, /etc/profile does not load this script. This is issue with alpine-baselayout-3.1.0-r0.

$ sudo mv /etc/profile.d/color_prompt /etc/profile.d/

The prompt before fix is the following.


The prompt after fix is the following.


2 ~/.profile

The commands for each user should be written to ~/.profile. There is not skelton of ~/.profile at /etc/skel. You need to create ~/.profile.

$ cat <<EOF > ~/.profile
if [ -d ~/bin ]; then
  export PATH=~/bin:\$PATH