linux file命令是如何识别文件的类型的

PHPor 的blog 2011-07-24 15:01:15 累计浏览 5,250 次
man file、 strace file /bin/ls , 发现:

    file命令参考magic文件/usr/share/file/magic.mgc, 如果/usr/share/file/magic.mgc不存在,会参考 /usr/share/file/magic ; 二者的关系为: magic.mgc 是magic 编译后的文件;编译方法为:

    file -C /usr/share/file/magic.mgc -m /usr/share/file/magic

同分类推荐文章

  1. NGINX Gateway Fabric 2.8: IP allow and deny lists, passive health checks, and cookie-based session persistence (2026-11-14 01:10:02)
  2. NGINX Ingress Controller 5.7: HTTP/2 to your upstreams, Opaque Secrets, and cert-manager challenges behind HTTPS redirects (2026-11-14 00:10:02)
  3. Hexo 文章一键发布到微信公众号 (2026-11-13 19:10:02)

查看更多 DevOps 文章 →

建议继续学习

  1. Linux如何统计进程的CPU利用率 (累计阅读 16,953)
  2. 我的 RHCA 之路 (累计阅读 14,368)
  3. Linux内存点滴 用户进程内存空间 (累计阅读 13,956)
  4. 给程序员新手的一些建议 (累计阅读 13,518)
  5. Linux 性能监控、测试、优化工具 (累计阅读 13,460)
  6. 关于linux内存free的一些事情 (累计阅读 13,398)
  7. Google怎么用linux (累计阅读 13,158)
  8. ps - 按进程消耗内存多少排序 (累计阅读 12,983)
  9. Linux Used内存到底哪里去了? (累计阅读 12,523)
  10. find命令的一点注意事项 (累计阅读 12,370)