simple bash stuff

Apologies if this is not the right place!

Trying to force myself to use/learn cli more I decided to put all of my downloaded *.pdf files in their own dir. Instead of drag/drop in Konqueror, I decided to try in a konsole. So after a couple of bashes(!) I started thus:

stephen@linux-oqc9:~> md linux_tips

and then ls, all fine, new dir exists.


stephen@linux-oqc9:~> mv Documents/.pdf linux_tips*


stephen@linux-oqc9:~> ls linux_tips
The “right” result, ie:
monitor.pdf wallchart.pdf zypper_cheat_sheet_p1_letter.pdf zypper_cheat_sheet_p2_letter.pdf
UserManual.pdf zypper_cheat_sheet_p1_a4.pdf zypper_cheat_sheet_p2_a4.pdf

So, then;,
stephen@linux-oqc9:~> kpdf linux_tips/zypper_cheat_sheet_p1_a4.pdf

and to my surprise, kpdf opened with the chosen document. I treated myself to a celebration cup of tea, and decided to track down any other *.pdf I have hiding away in my ~/


stephen@linux-oqc9:~> locate ~/.pdf*
The result???

Now these files are showing that they are in their ORIGINAL locations!!!
I went back to Konqueror, and the files are indeed in the new dir. Why does locate see them as still being in “Documents”? Also I have manually in Konq. found other *.pdf docs in ~/Desktop/DeskDocs, why did locate not find them?

Hehe now you have a new one look at using find … man find but it has some really horrible syntax which takes some getting used to.

In regards to what you did locate uses a db to search which is why it can be quicker than find but as you experienced if it isn’t updated it will report the old location.

To solve as root run updatedb iirc this is usually run as a cron job once a day.

TY feather for the quick and informative reply! I had asumed that removing Beagle had disabled file indexing, obv. there is other ferreting going on!
*Also I have manually in Konq. found other *.pdf docs in ~/Desktop/DeskDocs, why did locate not find them? *
is ~/Desktop/ not indexed then?

PS I did the update, and now all is well, locate also found the other *.pdf, which seem to have been there since March. I guess I do not have any auto-update cron jobbies active at all?

you shouldn’t rely on locate since it’s not a “real-time” program which constantly tracks changes on the file system but instead relies on a DB which needs updating with updatedb to have the newest changes in it… find will be a better solution

wakou wrote:
> found other *.pdf docs in ~/Desktop/DeskDocs, why did locate not find them?

locate didn’t find them because you put them there after updatedb ran?