I have installed a application (MATLAB) in Kubuntu and it is installed in /usr/local/bin.

If I type the name of the program in the terminal, it's not running and says that it did not find that command. When I go to that folder where it is installed and drag to the terminal and then it starts working.

I run this command echo $PATH in terminal and get this message:


I have installed this program on my old laptop on Ubuntu 16.04 LTS and was installed on /opt directory and when I typed matlab in terminal, it was working. Now this is not the case with Kubuntu.

Can anybody help me here as I am new user of Linux?

enter image description here

  • Please issue this command ls /usr/local/bin | grep -i MATLAB. If there is no output, then the binary file MATLAB is missing from folder usr/local/bin. It seems that the file missing in folders under your $PATH. Also issue commands sudo updatedb and locate -i MATLAB to find out where about of MATLAB. You may also try which command. – Marmayogi May 8 '19 at 4:44
  • when I run this command in terminal it works /usr/local/MATLAB/R2018a/bin/matlab – Gurpreet Singh May 8 '19 at 4:53
  • when I run this command in terminal it works /usr/local/MATLAB/R2018a/bin/matlab – Gurpreet Singh May 8 '19 at 5:00
  • how should I set the path. I mean what should I type in terminal – Gurpreet Singh May 8 '19 at 5:01
  • 1
    The answer is simple. Your binary matlab which is runnable is NOT under /usr/local/bin. Secondly, you have installed your software package under /usr/local/ and NOT under /usr/local/bin/. So PATH variable has no trace of your binary file matlab. So you should add entire Matlab installation directory including bin with PATH variable. – Marmayogi May 8 '19 at 5:35

A MATLAB installation tutorial says that by default the MATLAB installer will create a symbolic link in /usr/local/bin.

This means that you should be able to invoke MATLAB by typing matlab in the command prompt.

However, Questioner @GurpreetSingh has a MATLAB installation with missing symlink /usr/local/bin/matlab which is strange.

There are two solutions possible for this problem which are:

  1. Put the matlab bin in the path through PATH variable as follows:

    export PATH=/usr/local/MATLAB/R2018a/bin:${PATH}

    This export PATH should be placed either in ~/.bashrc file or in /etc/profile.d/matlab.sh (create this file if it does not exist)

  2. Create the following symlink (Also refer @steeldriver comment):

    $ sudo ln -s /usr/local/MATLAB/R2018a/bin/matlab /usr/local/bin/ 

Questioner @GurpreetSingh installed MATLAB on /opt directory in the previous Ubuntu 16.04 system and it correctly worked because the metlab binary with /opt installation path should have been correctly set in PATH manually. Or else a symlink should have been created manually in /usr/local/bin/ pointing to /opt/MATLAB/R2018a/bin/matlab.

Whereas in the present Kubuntu system, MATLAB was installed in /usr/local directory and the bin path was NOT set manually. The symlink was also missing from /usr/local/bin directory which was really strange!

This is how the Questioner @GurpreetSingh has ended up with this problem.

That is it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.