How to add a path to PATH variable in linux alpine for the entire machine?

I know I can export PATH="$PATH:my_path" to add to PATH variable in current session.

I also know that I can add this line to ~/.bash_profile to make it persist across sessions for my user:

echo 'PATH="$PATH:my_path"' >> ~/.bash_profile

I also know that in linux ubuntu I can add that line to /etc/bash.bashrc and it's avaiable always for all users.

However, my linux inside the container is alpine and I don't know where to add that file. I couldn't find it in Google.


Solution 1:

Alpine Linux uses by default ash as shell, it is quite similar to bash. The settings for everyone would be in the file /etc/profile

https://stackoverflow.com/a/35357011/2955337

if I had to find this myself I would run a find to see where PATH was set, I would grep through the etc directory.

grep "PATH=" /etc/*