Forrest logo
back to the mdls tool

mdls:tldr:70cec

mdls: Display a specific metadata attribute.
$ mdls -name ${attribute} ${filename}
try on your machine

The "mdls" command stands for "metadata list" and is used in macOS to display various metadata attributes of a file.

The "-name" option specifies a particular metadata attribute that you want to retrieve.

The "${attribute}" is a placeholder that should be replaced with the actual name of the attribute you want to retrieve. For example, if you want to retrieve the "kMDItemDisplayName" attribute, you would replace "${attribute}" with "kMDItemDisplayName".

The "${filename}" is another placeholder that needs to be replaced with the path or name of the file on which you want to retrieve the metadata attribute.

To summarize, the command "mdls -name ${attribute} ${filename}" is used to display the value of a specific metadata attribute for a given file in macOS.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mdls tool