help with long listing + locate
Hi
The time has come for me to unleash the power of piping on the command-line. Can any one help me with the following: I use "locate" to find a file, but I also want full details of the file, i.e. a long listing. As it stands locate only gives me its path. So, I reckon a pipe is in order. I tried ls -l < locate {filename} locate {filename} | ls -l However none of these worked. Anybody out there quick on the command line draw? |
Not very quick on the draw, but here is the answer:
You need to unleash the power of 'xargs'. Try this: locate porn.jpg | xargs ls -l TIM |
You might want to use the -r (--regexp=) option to locate, because it will find any file in the database that contains the string. The example below will only locate the exact match between the last '/' and the end of the line.
locate -r '^.*/<filename>$' |
All times are GMT -5. The time now is 09:02 PM. |