Skip to content
A command-line utility that prints the Uniform Type Identifier for files.
Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitattributes
.gitignore
LICENSE.md
Makefile
README.md

README.md

uti

A command-line utility that prints the Uniform Type Identifier for the files provided as an argument.

Requirements

  • macOS 10.4+

Usage

$ uti Hello.swift
public.swift-source

Results for multiple path arguments are printed on separate lines in the order they're provided:

$ uti index.html screen.css app.js
public.html
public.css
com.netscape.javascript-source

If any of the provided file path arguments are invalid, the command exits with status code 1 and prints a message to standard error.

$ uti invalid
error: invalid is not a file or directory

You can combine uti with other Unix commands. For example, to list the UTI for each file in a directory, you might invoke the find command like so:

$ ls .
Xcode_11.xip
Xcode.app

$ find . -exec uti {} +
com.apple.xip-archive
com.apple.application-bundle

Installation

Homebrew

Run the following command to install using homebrew:

$ brew install nshipster/formulae/uti

Manually

Run the following commands to build and install manually:

$ git clone https://github.com/NSHipster/uti.git
$ cd uti
$ make install

Additional Details

uti delegates to the mdls system command, requesting the kMDItemContentType metadata attribute and processing the output.

License

MIT

Contact

Mattt (@mattt)

You can’t perform that action at this time.