How to make a program callable from everywhere on Ubuntu/Linux/Bash | The Dev Tool | Toolel.com

Depending on the shell you need to update what is called upon start of your shell. For bash you need to insert the following in $HOME/.bashrc

export PATH=$HOME/bin/:$PATH

This makes it possible for you to add files to $HOME/bin and they become part of the runnable.

Let's say you have a file called hugo you want to make executable/runnable you can do that by:

mkdir $HOME/bin
cp hugo $HOME/bin/
chmod +x $HOME/bin/hugo

What if I don't have bash as shell?

You can usually find your shell by executing:

    ps -p $$
    # or
    echo $0
    # or
    pstree $$

After this you have to look up the equivalent of the startup script (bashrc for bash) for your shell.

Created by: martin

Comments

This page is only partially working without JavaScript. It will show content, but the tools and interactivity cannot be shown without JavaScript enabled. Please enable JavaScript for this page. About Us