Sorry, I know its been asked before, but how do i add an executable to the command list for the command line?

Such that typing: my-application will have the same effect as /home/user/path/my-application

I know i have to add a .Desktop (or was it a symlink?) file to a specific directory but i can't recall which one.

Please, can someone point in the right direction? I tried googling it and all i get are manuals for various commands


2 Answers 2


There is more than one way to skin this cat:

  1. You can put a symlink to your binary in a directory that is already in your PATH (/usr/local/bin for example).

  2. You can modify your PATH to include the directory with your binary in it. One way to do this is add the following to ~/.profile:

    PATH="$PATH:/path/to/directory/" export PATH

  3. You could even add an alias: alias <commandName> </path/to/your/binary>. Add it to your .bashrc file to recreate the alias when you log in.

There are probably other ways I haven't though of as well.

  • 2
    Just figured it's worth noting that many people add $HOME/bin to their $PATH, as /usr/local/bin requires root privileges to modify. While this may not benefit the original questioner, it should serve to help anyone who may perchance run into this same issue on a system on which they do not have root access (such as a public shell server).
    – 0xDAFACADE
    Sep 12, 2014 at 1:03

I like to use /usr/local/bin for my commands (or for links to them). That directory is usually in the PATH variable, which means that when you type a command the system looks there for it.

To create a link to the command:

ln -s /home/user/path/my-application /usr/local/bin/

Alternatively you can move the command to that path instead of linking. You need root permissions to do it anyway.

After that it should work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .