小编Bad*_*ake的帖子

如何为文件 -i 添加新的 mime 类型?

在我们的服务器上,我们遇到一些 MIME 类型问题。我需要为 Microsoft Publisher 文件添加 mime 类型,以便file -b -i theFile.pub打印application/x-mspublisher到命令行。我尝试将其添加到 中/etc/mimes.etc,但这不起作用。它继续说道application/x-msword

我也尝试过通过添加xml xgd-mime,但这也没有帮助。

我已经通过 hexedit 提取了文件开头的魔术字节,但是,我不确定如何将其添加到file. 有人可以帮忙吗?

再次强调,这只是关于命令行,而不是关于图标。

编辑以详细说明:

# Adobe ESP Script
#-------------------------------------------------------------------------
0               string  %\!PS-Adobe-3.1\ EPSF-3.0    Adobe EPS file
32              string  %\!PS-Adobe-3.1\ EPSF-3.0    Adobe EPS file
!:strength +50
!:mime application/postscript
Run Code Online (Sandbox Code Playgroud)

我已将其放入/etc/magic并运行,file -C并且这个有效。读取文件开头或 32 字节后的字符串。

# Mirosoft Powerpoint
#------------------------------------------------------------------------
1152    string/b        x50/x00/x6F/X00/x77&x00/x65/x00    Power
!:mime application/vnd.ms-powerpoint

# Microsoft Publisher
#--------------------------------------------------------------------------
0               quad    0xd0cf11e0a1b11ae1           Publisher …
Run Code Online (Sandbox Code Playgroud)

command-line rhel mime-types

5
推荐指数
1
解决办法
2393
查看次数

标签 统计

command-line ×1

mime-types ×1

rhel ×1