Change the default file opening mode in linux. In the Gnome File Manager (nautilus), when you double-click a file, the system will automatically call 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 some open methods of candidates or add open methods in batches. The configuration method for opening www.2cto.com GNMOE involves the following directories and files:/usr/share/applications ~ /. Local/share/applications/usr/share/applications/mimeinfo. cache ~ /. Local/share/applications/mimeinfo. cache go to these directories and you will find many files suffixed with. desktop. You can manually correct Partial Open Mode errors such as www.2cto.com vi preferred-web-browser.desktop [Desktop Entry] Version = 1.0 Encoding = UTF-8Type = ApplicationExec =/usr/local/softbase/firefox/firefoxTryExec =/usr/ local/softbase/firefox/firefoxName = Preferred Web BrowserGenericName = Web BrowserComment = Browse the WebIcon=redhat-web-browser.png Terminal = falseX-Panel-Monitor = trueNoDisplay = true after modification, you can solve the problem of opening command line parameters with incorrect methods, and right-click and select the default open mode. In general,/usr/sha Re/applications/defaults. list stores the global open mode ;~ The/. local/share/applications/directory stores the personal open mode (Candidate mode and personalized open mode). When the two are inconsistent, local personal settings are preferred. Www.2cto.com cd ~ /. Local/share/applications Delete useless open methods. Candidate open methods will no longer be like rm-rf wine *. [This takes effect immediately, no vi mimeapps will be available for all wine-Related Candidate menus. list process the current right-click menu and default open mode [effective now] rm-rf ~ /. Local/share/applications/mimeinfo. cache [or check first]/usr/share/applications are local desktop items and global desktop items/usr/share/applications/mimeinfo. cache ~ /. Local/share/applications/mimeinfo. cache is a global and local open mode cache. You can delete or change the order here to delete or change the default open mode. The/usr/share/applications/defaults. list structure is such a form of program type/file type = open the object item; [item 2;]… [Item n;] candidate open methods can be separated by commas (,), leaving no other characters to modify the open method of a file, you must first determine the type of this file. For example, if the type is plain, the default value is vim. desktop candidates are firefox. optional toptext/plain = vim. desktop; firefox. desktop can be edited 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 *. the structure of the desktop file [Desktop Entry] Encoding = UTF-8 // character Encoding Name = vim // realistic Name MimeType = text/plain; // Type Exec = vim % f // The program % f that runs indicates a parameter Type = Application // Type Terminal = true // whether Terminal NoDisplay = true // whether to display [panel menu] In the gnome menu ], of course, the desktop deletion will not be displayed in the pannel.