Use system command launching another copy of octave:
[output,text]=system("echo 'pkg list image' |octave -q 2>/dev/null",true);
output is:
output = 0
text = Package Name | Version | Installation directory
----------------+---------+-----------------------
data-smoothing *| 1.3.0 | /usr/share/octave/packages/data-smoothing-1.3.0
dataframe | 0.9.1 | /usr/share/octave/packages/dataframe-0.9.1
general *| 1.3.4 | /usr/share/octave/packages/general-1.3.4
io *| 2.0.2 | /usr/share/octave/packages/io-2.0.2
linear-algebra *| 2.2.0 | /usr/share/octave/packages/linear-algebra-2.2.0
miscellaneous *| 1.2.0 | /usr/share/octave/packages/miscellaneous-1.2.0
nnet *| 0.1.13 | /usr/share/octave/packages/nnet-0.1.13
odepkg *| 0.8.4 | /usr/share/octave/packages/odepkg-0.8.4
optim *| 1.3.0 | /usr/share/octave/packages/optim-1.3.0
optiminterp *| 0.3.4 | /usr/share/octave/packages/optiminterp-0.3.4
parallel *| 2.2.0 | /usr/share/octave/packages/parallel-2.2.0
plot *| 1.1.0 | /usr/share/octave/packages/plot-1.1.0
splines *| 1.2.6 | /usr/share/octave/packages/splines-1.2.6
statistics *| 1.2.3 | /usr/share/octave/packages/statistics-1.2.3
strings *| 1.1.0 | /usr/share/octave/packages/strings-1.1.0
struct *| 1.0.10 | /usr/share/octave/packages/struct-1.0.10
symbolic *| 1.1.0 | /usr/share/octave/packages/symbolic-1.1.0
Also, you can list all packages. From octave documentation:
'list'
Show the list of currently installed packages. For example,
installed_packages = pkg ("list")
returns a cell array containing a structure for each installed
package.
If two output arguments are requested 'pkg' splits the list of
installed packages into those which were installed by the
current user, and those which were installed by the system
administrator.
[user_packages, system_packages] = pkg ("list")
The option "-forge" lists packages available at the
Octave-Forge repository. This requires an internet connection
and the cURL library. For example:
oct_forge_pkgs = pkg ("list", "-forge")