Bmm
Bmm

Reputation: 57

How to I find the full path of an application or file in linux?

I have to manually add paths to multiple files in a matlab script, i.e. my matlab directory or startup.m, but i am unsure as to how to find the full file path for either of these on a unix system

I have tried find, which, whereis, but none seem to provide the full file path

ie

whereis matlab

find matlab

Upvotes: 0

Views: 270

Answers (1)

Cris Luengo
Cris Luengo

Reputation: 60615

matlabroot returns the directory where MATLAB is installed:

p = matlabroot;

The MATLAB executable is typically in fullfile(matlabroot,'bin','matlab').

To find the location of an M-file that is on the MATLAB path, use which:

p = which('startup')

Upvotes: 1

Related Questions