linuxbashlocate

How can I display last updates from mlocate in linux?


Heloo, I am new in linux. I am trying to display the last updates of ´mlocate´. So that when I use the locate command it finds items according to the last update of ´mlocate´.

How can I do it?

Thanks for your reponse, Gerard


Solution

  • I think you mean last update to database.

    mlocate -S  |  head -1   | cut -d' ' -f2 | tr -d ':'  | xargs ls -ltr | cut -d' ' -f6-8
    

    Demo:

    $mlocate -S  |  head -1   | cut -d' ' -f2 | tr -d ':'  | xargs ls -ltr | cut -d' ' -f6-8
    Mar 30 04:28
    $