How to put executable to /usr/local/bin? [duplicate]

I realise this is basic but I have read two pages of google answers and am still unclear 'How to put executable in /usr/local/bin?'

I have downloaded a package and made the executable called profit. What is the step by step command line to make profit executable from the terminal without having to add the path/to/profit every time?


Just copy it to /usr/local/bin.

sudo cp /path/to/profit /usr/local/bin

There are various things to consider; just for completeness:

First of all, you should make sure that this executable has in fact the required permissions.

sudo chmod a+rx /path/to/profit

(for example when extracting archives that were thrown together using the zip tool, permissions can get lost)

Then you can either copy the file as Gunnar suggested; or you can create a symbolic link:

sudo ln -s /path/to/profit /usr/local/bin

Depending on your context, using a link might be more convenient in the future; on the other hand it carries some security risks (for example when /path/to/profit can be written by non-root users)


step 1: chmod +x /path/to/profit

step 2: sudo cp /path/to/profit /usr/local/bin/

step 3: profit