Results 1 to 5 of 5

Thread: simple bash stuff

  1. #1
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,085

    Default 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.

    Then:

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

    and:

    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 ~/

    So;

    stephen@linux-oqc9:~> locate ~/*.pdf
    The result???
    /home/stephen/Documents/monitor.pdf
    /home/stephen/Documents/UserManual.pdf
    /home/stephen/Documents/wallchart.pdf
    /home/stephen/Documents/zypper_cheat_sheet_p1_a4.pdf
    /home/stephen/Documents/zypper_cheat_sheet_p1_letter.pdf
    /home/stephen/Documents/zypper_cheat_sheet_p2_a4.pdf
    /home/stephen/Documents/zypper_cheat_sheet_p2_letter.pdf
    /home/stephen/linux_starter_pack/linux_starter_pack.pdf


    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?

    Tumbleweed/KDE/Ati Radeon R9 270/AMD FX-6300/8Gb DDR3

  2. #2

    Default Re: simple bash stuff

    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.
    Man first, have a try at Info, have a look at Wiki, if all that fails Scroogle!!!!!
    If I've helped click on the Rep button I don't know what it does but it sounds cool.

  3. #3
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,085

    Default Re: simple bash stuff

    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?

    Tumbleweed/KDE/Ati Radeon R9 270/AMD FX-6300/8Gb DDR3

  4. #4
    Join Date
    Jun 2008
    Location
    /dev/belgium
    Posts
    1,946

    Default Re: simple bash stuff

    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

  5. #5
    platinum NNTP User

    Default Re: simple bash stuff

    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?

    --
    platinum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •