opening files using terminal (Unity)
Hello again all!
Ok so I'm using Ubuntu 12.10 and Unity.
I'm going through some basic lessons of using the terminal.
But how do I open a "examplefile.odf" using the terminal?
I had a search, but all involved Gnome or KDE.
Thanks for reading / helping.
Cheers,
Gareth
Re: opening files using terminal (Unity)
ODF files are opendocument files. so if you have libre office installed (most likely will) call that application to open all .odf files.
:~$ libreoffice /path/to/file.odf
Re: opening files using terminal (Unity)
simply type in a Terminal window:
Code:
cd /path/to/yourfile
libreoffice yourfile
e.g.:
Code:
cd Documents
libreoffice examplefile.odf
Re: opening files using terminal (Unity)
Thanks Rooster,
That's cool - but is there a quicker way akin to the "gnome open" or "kde open" file.odf ?
Thanks for your input - it's early days for me using the terminal so learning the "normal" way is also good.
Re: opening files using terminal (Unity)
You can use the command xdg-open, for example...
Will open file.odf with LibreOffice Writer (or whatever application you have associated with odf files).
The xdg-open command is desktop agnostic, it will work with any DE that follows the xdg specification (all of them AFAIK).
Re: opening files using terminal (Unity)
Quote:
Originally Posted by
Cheesemill
You can use the command xdg-open, for example...
Will open file.odf with LibreOffice Writer (or whatever application you have associated with odf files).
The xdg-open command is desktop agnostic, it will work with any DE that follows the xdg specification (all of them AFAIK).
I never knew about this one. You never stop learning.
Don't forget Gareth, if you are currently working in the directory that the file is in (as in if you just type "ls" it is listed) try this:
:~$ libre<TAB KEY> exam<TAB KEY>
at <TAB KEY> hit the tab key, rather than write it with the <>... (I don't mean to sound condescending, but when learing it helps to explain clearly)
If you haven't leart tab completion, tell us what you see happen.
Re: opening files using terminal (Unity)
Wow, thanks guys - I am really enjoying being part of the linux community (I have a system 76 so i'm in at the deep end!) - thanks for all the help people.
Will try these later and report back.
Cheers,
Gareth.
Re: opening files using terminal (Unity)
OK after first efforts:
1. xdg-open file.extension seems to work - (I need to be in the right directory though, right? - i.e I cant open "file.odt" from home, I have to go to "documents" first?) - it opened up the file in LibreOffice and allowed me to edit it etc however - the terminal came up with (sorry I can't print screen right now) "javaldx: could not find a runtime environment" , JVM, failed to read path from javaldx, fontconfig warning.....
So like I say, it seems to work, but terminal comes up with 9 or 10 lines of scary looking stuff!
2.The tab completion thing seems useful (I was unaware of this, so thank you) - it shows relevant programs (like an auto complete?) but I don't understand why the second part - "exam <tab> "
OK, thanks again for reading & helping :razz:
Re: opening files using terminal (Unity)
Quote:
- (I need to be in the right directory though, right? - i.e I cant open "file.odt" from home, I have to go to "documents" first?)
If you are in the home directory you have to specify an absolute path to the file for the command xdg-open, but your home directory itself can be replaced in the command with the system variable for it, the tilde symbol or ~.
eg (from home),
Code:
xdg-open ~/Documents/file.odt
Note the terminal is case sensitive and the documents folder must have a capitalized "d".
If you are in the Documents folder (note the capital d :)) then the code can become,
this in terminal is known as a relative path; compared to first code which uses an absolute path. The path, or file.odt directly in this case, is relative to the location you have changed directory to (the ~/Documents folder itself). Cheers.
Re: opening files using terminal (Unity)
Quote:
Originally Posted by
Gareth Edwards
Hello again all!
Ok so I'm using Ubuntu 12.10 and Unity.
I'm going through some basic lessons of using the terminal.
But how do I open a "examplefile.odf" using the terminal?
I had a search, but all involved Gnome or KDE.
Thanks for reading / helping.
Cheers,
Gareth
I think I know what you mean by "example.odf" but I'm not sure that .odf is a file extension, per se. You'll have example.odt (Writer), example.ods (Calc), example.odg (Draw), etc.