Challenge ·Medium

Persist a Custom Binary Directory in $PATH

Mister P
by  Mister P · on
Linux
A custom application has been installed to a non-standard location. Configure the laborant user's environment so the application's directory is permanently available in $PATH for all future login shells.

A custom application binary has been placed at /opt/myapp/bin/myapp on rocky-01.

The laborant user needs to be able to run myapp by name in any future login shell — without specifying the full path and without any manual setup after logging in.

Complete the following tasks on rocky-01 as the laborant user.

Hint 1 — Where to look

The shell searches for commands in directories listed in the $PATH variable. Inspect your current $PATH to understand what's already there and what needs to be added.

Hint 2 — Making it permanent

A change made with export PATH=... in the terminal only lasts for the current session. To make it survive a new login, the export line must be written to a shell initialization file that login shells read automatically.

Hint 3 — Which file on Rocky Linux 9

On Rocky Linux 9, Bash login shells read ~/.bash_profile at startup. Add the export line there. Use single quotes around the value so $PATH is not expanded immediately: export PATH=/opt/myapp/bin:$PATH

Hint 4 — Testing without logging out

You can test whether your change works without logging out:

bash --login -c 'echo $PATH | tr ":" "\n"'

If /opt/myapp/bin appears in the output, the change is persistent.