https://github.com/NSHipster/uti
A command-line utility that prints the Uniform Type Identifier for files.
https://github.com/NSHipster/uti
macos uniform-type-identifier uti
Last synced: about 1 year ago
JSON representation
A command-line utility that prints the Uniform Type Identifier for files.
- Host: GitHub
- URL: https://github.com/NSHipster/uti
- Owner: NSHipster
- License: mit
- Archived: true
- Created: 2019-11-24T22:31:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-04T15:03:48.000Z (over 6 years ago)
- Last Synced: 2024-11-06T07:40:00.578Z (over 1 year ago)
- Topics: macos, uniform-type-identifier, uti
- Language: Shell
- Size: 6.84 KB
- Stars: 31
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# uti
A command-line utility that prints the
[Uniform Type Identifier](https://en.wikipedia.org/wiki/Uniform_Type_Identifier)
for the files provided as an argument.
## Requirements
- macOS 10.4+
## Usage
```terminal
$ uti Hello.swift
public.swift-source
```
Results for multiple path arguments are printed on separate lines
in the order they're provided:
```terminal
$ 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.
```terminal
$ 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:
```terminal
$ 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](https://brew.sh/):
```terminal
$ brew install nshipster/formulae/uti
```
### Manually
Run the following commands to build and install manually:
```terminal
$ 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](https://twitter.com/mattt))
[`mdls`]: https://www.unix.com/man-page/osx/1/mdls/