Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: opening files using terminal (Unity)

  1. #1
    Join Date
    Feb 2013
    Beans
    24

    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

  2. #2
    Join Date
    May 2012
    Location
    Queensland, Australia
    Beans
    51
    Distro
    Ubuntu 12.04 Precise Pangolin

    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

  3. #3
    iMac71 is offline Gee! These Aren't Roasted!
    Join Date
    Dec 2012
    Beans
    171

    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

  4. #4
    Join Date
    Feb 2013
    Beans
    24

    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.

  5. #5
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: opening files using terminal (Unity)

    You can use the command xdg-open, for example...
    Code:
    xdg-open file.odf
    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).
    Cheesemill

  6. #6
    Join Date
    May 2012
    Location
    Queensland, Australia
    Beans
    51
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: opening files using terminal (Unity)

    Quote Originally Posted by Cheesemill View Post
    You can use the command xdg-open, for example...
    Code:
    xdg-open file.odf
    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.

  7. #7
    Join Date
    Feb 2013
    Beans
    24

    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.

  8. #8
    Join Date
    Feb 2013
    Beans
    24

    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

  9. #9
    Join Date
    Aug 2012
    Location
    Queensland, Australia
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: opening files using terminal (Unity)

    - (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,
    Code:
    xdg-open file.odt
    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.
    Last edited by coldcritter64; March 11th, 2013 at 01:32 PM. Reason: more info for clarity + change .odf to .odt

  10. #10
    Join Date
    Dec 2007
    Location
    Bombay
    Beans
    5,836
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: opening files using terminal (Unity)

    Quote Originally Posted by Gareth Edwards View Post
    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.
    de gustibus et coloribus non est disputandum -- Wiktionary

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •