Celeb Glow
general | March 11, 2026

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.

1 Answer

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

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/*
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy