How can I run LibreOffice Writer from the command line? Basically, what is its command and how do I get to know what's the command to run a particular application in general?
How can I run LibreOffice Writer from the command line? Basically, what is its command and how do I get to know what's the command to run a particular application in general?
Run
libreoffice --writer
to start LibreOffice Writer.In this case, I guessed that it might be
libreoffice
or similar, so I enteredlibre
in a terminal and pressed tab twice.libreoffice
was one of the options, so I ran that. It started something from which one could choose to go to Writer, Calc, Impress, etc. Since you asked specifically about Writer, I looked atman libreoffice
, which mentions-writer
as one of the command line options. Runninglibreoffice -writer
worked but resulted inAnd so I got to
libreoffice --writer
.In general, one could try things like the following:
ps aux | grep guessed_name
.X
, rundpkg -L X
. It will list installed files from packageX
, look for/usr/bin
,/bin
,/sbin
, etc in the output.One can find out the process corresponding to a window as follows :
Run
xprop _NET_WM_PID
, navigate to the target window (without clicking!), and click on it. This will print the PID corresponding to the window, for exampleNow run
ps -p 7394
(with 7394 replaced by the PID you got) to find out the process name for the given PID.To find a command, try using command auto-complete:
type 'libre', then press ['Tab'], giving you:
then add ' --help', finally giving you:
This will give you ALL the possible options you might need ..
One very easy way which does not involve any guessing at all:
alacarte
(that's 'Main Menu' in the Gnome menu).Properties
.Command
, in this example it isfile-roller
.Usually all GUI applications have a launcher icon. Most of them are stored in
/usr/share/applications
. These.desktop
files contain information about application name and their corresponding commands.A quick hacky way to list all applications and commands is to use awk command:
When I access Writer I go into my terminal and type:
This seems to work perfectly and can be repeated for Calc (localc); Draw (lodraw); Base (lobase); Impress (loimpress). You get the point.
The other wonderful terminal command I learned tonight is this:
this will call up Firefox while taking you to the website of your choice or in this case Google. The more that I play around with the Command Line Interface (CLI) the more that I fall in love with all of the capabilities.
Honestly, this can easily be google'ed :p
On Ubuntu 12.10 and the new libreoffice 4.0, after manual installation, the command is:
libreoffice4.0 --writer
all other commands, like previous answer, are given with the inclusion of 4.0 after libreoffice.
If I have no idea where a program is, or what it is called, and only have the link from the "start menu", I will create a desktop shortcut with right click -> add to desktop. Then I will open the shortcut in a text editor and look for the line starting with "Exec". So, for LibreOffice Calc, I see:
Exec=libreoffice --calc %U
This corresponds to the bash command "libreoffice --calc". The percent-sign has to do with an extended implicit (?) option for exec, which I don't understand but which can be ignored since you're not using Exec.
To start LibreOffice on an existing document, use
xdg-open
. This not only works for LibreOffice documents but for any file or URL.xdg-open
will open the file using your preferred application.As I usually work from the terminal, my
~/.bash_aliases
has analias o=xdg-open
, so it reduces to this: