How to adjust the file opening mode in Linux

Source: Internet
Author: User
Article Title: how to adjust the file opening mode in Linux. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems and open source, and other basic categories in Gnome's file manager (nautilus), double-click a file, the system automatically calls the corresponding program to open the file. In Nautilus, you can modify the default open mode by right-clicking the menu, but it lacks flexibility and operability. For example, you cannot delete open methods of some candidates or add open methods in batches.
 
The configuration of how GNMOE is opened involves the following directories and files:
 
/Usr/share/applications
 
~ /. Local/share/applications
 
/Usr/share/applications/mimeinfo. cache
 
~ /. Local/share/applications/mimeinfo. cache
 
Check these directories and you will find a lot. Desktop is a file with a suffix.
 
In general,/etc/gnome/defaults. list stores the global open mode;
 
~ /. Local/share/applications/defaults. list stores the personal open mode. When the two are inconsistent, local personal settings are preferred.
 
~ /. Local/share/applications
 
/Usr/share/applications
 
These two are local desktop items and global desktop items respectively.
 
/Usr/share/applications/mimeinfo. cache
 
~ /. Local/share/applications/mimeinfo. cache
 
The two are global and partial open mode caches. You can delete or change the order here to delete some open mode or modify the default open mode.
 
The structure of/usr/share/applications/defaults. list is as follows:
 
Program type/file type = the item for opening the file; [item 2;]… [Item n;]
 
Candidate open methods can be separated by commas (,) without leaving other characters
 
To modify the file opening method, you must first determine the file type.
 
For example, if a plain text file is opened in plain mode, the candidate for vim. desktop is firefox. desktop by default.
 
Text/plain = vim. desktop; firefox. desktop
 
You can edit it directly.
 
~ /. Local/share/applications/defaults. list
 
After editing, manually modify
 
/Usr/share/applications/mimeinfo. cache
 
~ /. Local/share/applications/mimeinfo. cache
 
These two cache files.
 
Next, let's take a look at the structure of the desktop file.
 
[Desktop Entry]
 
Encoding = UTF-8 // character Encoding
 
Name = vim // real Name
 
MimeType = text/plain; // type
 
Exec = vim % f // The running program % f represents a parameter
 
Type = Application // Type
 
Terminal = true // whether to use the Terminal
 
NoDisplay = true // whether it is displayed in the gnome menu
 
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.