FreeSoftware to the fullest!

Integrating with the console

Just a quick technical note.
I was recently seeing how one of the tutors on the project I’m working on behaved with MacOS X and the console, I realised that he was using a lot the command open [filename] to open any document and decided I wanted that (I figured out that KDE had that but I couldn’t find the command open was not there).
Just after that, I realised at some other moment that we indeed have some kde-open command which does exactly that.

Since I didn’t like that it’s a little too long to write it all the time and that I don’t like to have my console polluted with doubtfully useful debug information I created this simple alias:

alias open="kde-open 2> /dev/null > /dev/null"

Maybe it can be useful for somebody.
Cheers!

10 Comments

  1. IAnjo

    You can also use xdg-open, that should open the right app for both KDE and GNOME.

  2. cedric

    kde-open > /dev/null 2>&1

  3. Diego

    You can use xdg-open, which works under gnome too, and respects user preferences and per desktop defaults.

  4. Eike Hein

    I’ve been using the fish shell for many years, which had a built-in cross-desktop “open” command long before xdg-open or kde-open came along: http://fishshell.org

  5. Artem S. Tashkinov

    “kde-open &> /dev/null” will do the same.

  6. saLOUt

    Hey,

    it works with http:// pages (html/pdf) and sftp, too!

    Thanks for the tip.

  7. Fri13

    Just one awesome alias more what to use daily!

    Many times there is a need just to open file from CLI and to first check the MIME and then itself write appname filename.ext

    Thanks for the TIP!

  8. Samat Jain

    Never knew about kde-open and xdg-open. I’ve been using this shell script:

    #!/bin/sh
    exec kfmclient exec “$@”

    since the KDE3 days.

  9. Daniel Hahler

    Z Shell has a nice feature to just execute arbitrary files, by executing them, e.g.:
    % ~/my_image.jpg

    See http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#SEC288

  10. RainCT

    I have “go” as alias for “gnome-open”, and it’s probably the command I use the most after cd and ls.

© 2024 TheBlindCow

Theme by Anders NorenUp ↑