• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

mimetype Command Examples in Linux

by Deepika

“mimetype” is a command line utility in Unix-like operating systems that determines the MIME type of a file. MIME (Multipurpose Internet Mail Extensions) types are used to specify the format of a file, such as whether it is a text file, an image, a video, or some other type of content. The “mimetype” command takes a file name as input and outputs the corresponding MIME type of that file. This information is useful for various purposes, such as determining the appropriate application to open a file with, or determining the format of a file for further processing.

The mimetype command uses a database of known file extensions and MIME types to determine the MIME type of a file. The database is updated regularly and new file formats and MIME types can be added as needed. Using “mimetype” is a simple and efficient way to determine the MIME type of a file, especially for use in scripts and automation tasks. The tool can also be useful for troubleshooting issues with file formats and for determining the appropriate format for a file before it is transferred or processed.

mimetype Command Examples

1. Print the MIME type of a given file:

# mimetype path/to/file

2. Display only the MIME type, and not the filename:

# mimetype --brief path/to/file

3. Display a description of the MIME type:

# mimetype --describe path/to/file

4. Determine the MIME type of stdin (does not check a filename):

# some_command | mimetype --stdin

5. Display debug information about how the MIME type was determined:

# mimetype --debug path/to/file

6. Display all the possible MIME types of a given file in confidence order:

# mimetype --all path/to/file

7. Explicitly specify the 2-letter language code of the output:

# mimetype --language path/to/file

Filed Under: Linux

Some more articles you might also be interested in …

  1. df Command Examples in Linux
  2. exrex: Generate all/random matching strings for a regular expression
  3. clamscan: A command-line virus scanner
  4. dvc unfreeze: Unfreeze stages in the DVC pipeline
  5. retroarch Command Examples in Linux
  6. asciidoctor: A processor that converts AsciiDoc files to a publishable format
  7. gh pr: Manage GitHub pull requests from the command-line
  8. Basic vim commands (cheat sheet)
  9. idle3: command not found
  10. CentOS / RHEL : How to change password hashing algorithm

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright