2

For example , there are two files a.ppt and b.jpg .

And I can call a magic method to open them appropriately just like :

magic_method a.ppt
magic_method b.jpg

And it open libreoffice writer and image viewer or something that fit the file type .

Is there any command or script for that?

  • For Mac users reading this, OS X has an open command. – Wildcard Apr 16 '16 at 2:04
2

You might be thinking of xdg-open:

xdg-open opens a file or URL in the user's preferred application. If a URL is provided the URL will be opened in the user's preferred web browser. If a file is provided the file will be opened in the preferred application for files of that type. xdg-open supports file, ftp, http and https URLs.

The Arch Wiki lists some alternative tools.

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.