Linux command
update-mime-database 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Update system MIME database
sudo update-mime-database /usr/share/mime
Update user MIME database
update-mime-database ~/.local/share/mime
Show version
update-mime-database -v
Display help
update-mime-database -h
说明
update-mime-database builds the shared MIME-Info database cache from XML source files. It scans the specified directory for MIME type definitions and compiles them into an optimized binary cache (mime.cache) for fast application access. The database maps file patterns, magic bytes, and other characteristics to MIME types, enabling applications to correctly identify file types. System-wide definitions go in /usr/share/mime while user customizations use ~/.local/share/mime. Package managers typically run this command automatically when installing software that provides new MIME type definitions. Manual execution is needed when adding custom MIME types.
参数
- -h
- Display help and exit.
- -v
- Display version and exit.
- -V
- Verbose output during processing.
- -n
- Only update if files have changed.
FAQ
What is the update-mime-database command used for?
update-mime-database builds the shared MIME-Info database cache from XML source files. It scans the specified directory for MIME type definitions and compiles them into an optimized binary cache (mime.cache) for fast application access. The database maps file patterns, magic bytes, and other characteristics to MIME types, enabling applications to correctly identify file types. System-wide definitions go in /usr/share/mime while user customizations use ~/.local/share/mime. Package managers typically run this command automatically when installing software that provides new MIME type definitions. Manual execution is needed when adding custom MIME types.
How do I run a basic update-mime-database example?
Run `sudo update-mime-database /usr/share/mime` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -h do in update-mime-database?
Display help and exit.