macos run progrma from terminal code example
Example: how to open any application using terminal
ou can just type the the name of the application you want to start.
In your case it would be libreoffice or if you want to go to writer
directly you can type libreoffice --writer