How can one use the executables stored in the /bin directory of root installation folder?

Hi everybody,
I was trying to use the “hadd” executable to merge multiple root files in the root interface, i.e I’ve typed the following two commands on terminal:

root
hadd MergedOutput.root output{0…3}.root

However it gives an error message since it can’t recognized the identifier “hadd”.
I tried to execute the following command from inside the /bin directory placed in my root installation folder and it works (the files are correctly merged):

hadd /home/rico/Geant4/rico_folder/sim/build/MergedOutput.root /home/rico/Geant4/rico_folder/sim/build/output{0…3}.root

I wonder if there is a simple way to tell root to look for the executables stored in the /bin directory when typing commands from inside the root cling interface, so that the first command that I tried can work well.
Thanks in advance.

_ROOT Version: 6.26/00
_Platform: Ubuntu 18.04

From the “root” prompt, you can run any executable using its “.!” meta command, e.g.: .! hadd MergedOutput.root output{0…3}.root

1 Like

It works nicely, thank you very much!

Hi @Rico ,

maybe it’s obvious, but just to clarify: although you can call other programs from the ROOT prompt like @Wile_E_Coyote showed, the programs under /bin are in general designed to be executed from a shell rather than the ROOT prompt, as standalone utilities. And in general the expectation is that the /bin directory with these programs is added to your PATH environment variable so these programs are readily available from a terminal or a bash script.

Cheers,
Enrico

1 Like

For a beginner like me, It wasn’t obvious at all. Thanks!