How to make an executable accessible on Linux path

If you want to make an executable accessible, you need to move it to /usr/bin. This will make it available as a terminal command.

Step by step example

We will start off with file makeMeHappy file in /home/Documents in the terminal below (scroll).

Step 1: Make the file executable

chmod +x makeMeHappy

Step 2: Test the file in the current directory

./makeMeHappy
# you have happiness within you

Step 3: Try calling the file without ./

makeMeHappy
# bash: makeMeHappy: command not found

Step 4: Move the file to /usr/bin (use sudo if you’re running locally)

mv makeMeHappy /usr/bin

Step 5: Test your new executable

makeMeHappy
# you have happiness within you
Terminal 1
Terminal
Loading...

Share this tutorial if you found it useful. Thanks for following along. Adios ✌🏾🧡.

Free Resources