How do you get details from the output of the locate command?

When I run the ls -l command I get details about the files in the current directory like permissions, owner, group, file size.

Is there a way I can get these same details instead of just the location of the file when I run locate?


The locate database do not contain information other that names, so you should run some other tool, like ls, on locate output

lsloc() {
  locate "$@" | 
    while read -r name; do
      ls -ld "$name"
    done
}
lsloc pattern

Pipe the output of locate to xargs (adding ls -l as parameters to xargs). This lets you use whatever options you need with either command. By also passing the -0 (dash-zero) option to both commands, you also protect against unintended interpretations of blanks or newlines in filenames. For example, to get the details of all .iso files on my system:

locate -0 -r '.*.iso$' | xargs -0 ls -l