How to Use the command line xdg-open in the GNU/Linux operating system to open a file in any format

Source: Internet
Author: User

/*************************************** ******************************
* Author: Samson
* Date: 04/07/2014
* Test platform:
* 3.11.0-12-generic # 19-Ubuntu
* GNU bash, version 4.2.45
**************************************** ****************************/


In GNU/Linux, when you need to open files of other formats, we usually go to the directory where the files are located and double-click to open the files, which affects efficiency. In fact, you can use the xdg-open command to open these format files, or even web pages, as simple as opening a file.


In GNU/Linux, you can use command lines to open text files, such as gedit, more, cat, vim, and less. However, when you need to open other format files, such as pdf, jpg, and mp3 files, we usually go to the directory where the files are located and double-click to open them, which affects efficiency. In fact, you can open these format files by running the xdg-open (opens a file or URL in the user's preferred application) command.

Xdg-open: the function is to open the file to be opened using the user's preferred application. If you want to open a jpeg file, you can use xdg-open fuckgfw.jpeg to open the jpeg file using the preferred (or understood as the default) application;

For more instructions, you can install the command line in the GNU/Linux release and run man xdg-open for more detailed instructions;


For more information about xdg-series command lines, refer:
Http://portland.freedesktop.org/xdg-utils-1.0/



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.