Ask Your Question

Open new file from command line?

asked 2015-03-06 16:06:11 +0200

juanm gravatar image

updated 2021-05-07 17:52:31 +0200

Alex Kemp gravatar image

It is very common on Linux to do

command filename

from the command line, and programs will try to open the file called filename or, if it does not exist, create it. However, when I do

libreoffice spread.ods

I get an error saying that the file does no exist. Additionally, if just open libreoffice from the command line without specifying a filename and then open the save-file dialog, the default location is not the directory from where I issued the command, but my home. I find these behaviour inconvenient for my workflow... Is there any way to create a new empty file from command line and open it directly?


edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2015-08-05 09:26:45 +0200

Rolf23 gravatar image

There appears to be no option available, which is something of an oversight.
However, create a blank document of the type that you wish to use and save it i.e. mybase.odt or mybase.ods
Then on the command line
cp mybase.odt mynewfilename.odt
cp mybase.ods mynewfilename.ods

and then
libreoffice mynewfilename.odt
localc mynewfilename.ods

edit flag offensive delete link more

answered 2018-05-04 16:53:51 +0200

If I'm in my terminal in Linux and I want to open an odt file I just type lowriter then the file name. For example, if I want to open the file pizza.odt through the terminal I would type: lowriter pizza.odt and the file will open in Libre Writer.

edit flag offensive delete link more

answered 2018-05-04 18:06:11 +0200

carnish gravatar image

updated 2018-05-04 18:10:03 +0200

I have an alias in the alias file that is sourced when I open a terminal.

alias writer='/usr/bin/libreoffice --writer --norestore &>writer.log'


writer mydoc.odt &

will open the file in writer.

In Ubuntu and Solaris the alias file is ~/.bash_aliases by default. Other distros may be different. In Debian I had to modify the ~/. profile file.

The --norestore bypasses the document recovery process which for me always otherwise runs and has never been necessary. If it turns out that a document does need recovery then you can run writer without this switch.

The redirect of output '> ' spares me from warnings and errors that are rarely important but will be put to the writer.log file if something goes awry.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2015-03-06 16:06:11 +0200

Seen: 22,820 times

Last updated: May 04 '18