is the command locate too old for debian 13 xfce?
from arsus5478@lemmy.ml to linux@lemmy.ml on 04 Sep 09:41
https://lemmy.ml/post/35664182

locate is a command I’ve used in the past, but now, fresh installed with sudo apt get locate it doesn return anything.

locate --version returns locate (GNU findutils) 4.10.0, from 2024

or, have I forgotten something?

#linux

threaded - newest

gi1242@lemmy.world on 04 Sep 09:45 next collapse

IIRC u need mlocate or plocate…

oshu@lemmy.world on 04 Sep 10:30 next collapse

run these two commands:

sudo apt install mlocate

sudo updatedb

frongt@lemmy.zip on 04 Sep 11:09 next collapse

Is the package named findutils?

infjarchninja@lemmy.ml on 04 Sep 11:51 next collapse

for me

locate --version

returns:

plocate 1.1.23

sudo apt-get install plocate

not locate

thingsiplay@beehaw.org on 04 Sep 12:20 next collapse

Several distributions made an effort to replace locate with alternative and updated versions of it. For usage the command name is still locate, but the package name should be different, in example mlocate or plocate and there are other alternatives too. The main difference between the old and new versions is they are faster.

N0x0n@lemmy.ml on 04 Sep 13:25 collapse

plocate is backwards-compatible with mlocate, and is much faster and more efficient than mlocate. source

From your personal experience, what do you prefer and why, if you don’t mind :).

thingsiplay@beehaw.org on 04 Sep 13:40 collapse

I actually don’t have a preference. I usually just use the default locate implementation my distribution provides. I used mlocate before and when the distros switched to plocate, I rolled along with that without making efforts installing mlocate from a different source. Its the easiest and safest way to me. Usage and performance between mlocate and plocate seems to be identical in my experience (no benchmark, just how it “felt”). plocate is actually mlocate with a few patches for edge cases, if I understand it right.

I have it currently uninstalled due to an issue:

However, recently I had some issues with the locate and KDEs baloo (baloo can do content indexing too but I set it to only filename indexing, so its similar to locate). Those tools may have killed my previous system SSD and on my new one I noticed they used up Gigabytes of RAM and seem to be stuck. After investigating both tools seem to have choked on few filenames that contain unusual characters. Therefore I have disabled them for now until figured out how to deal with this (probably renaming) and try later again.

Botzo@lemmy.world on 04 Sep 13:21 next collapse

You can search the package database to determine which package(s) provide a file with dpkg --search $file

tychosmoose@lemmy.world on 04 Sep 13:50 next collapse

Just tried this on a recent Trixie amd64 install. locate isn’t installed by default, but there is a locate/stable 4.10.0-3 package and it installs just fine for me.

sudo apt update
sudo apt install locate
limelight79@lemmy.world on 04 Sep 14:28 next collapse

I’m pretty sure it wasn’t installed by default in the previous version either, and maybe even the one before that. It’s a useful utility, after you locate it.

gnuhaut@lemmy.ml on 04 Sep 15:49 next collapse

locate uses an index you need to update using updatedb before it is able to find anything.

updatedb may run periodically because of a cron job, but the index is probably missing right after installing it manually.

interdimensionalmeme@lemmy.ml on 04 Sep 16:11 collapse

Why don’t filesystems maintain such a database so you don’t have to spend cycles on a file indexer ?

wewbull@feddit.uk on 04 Sep 16:25 next collapse

They do. You look at it every time you see the contents of your disk. It’s just organised in a tree to make path based lookups fast and locate organises its database differently to make fast basename lookups.

gnuhaut@lemmy.ml on 04 Sep 16:42 collapse

I guess because that adds extra complexity that isn’t inherently necessary and can be added on top, plus it eats resources. You’ll spend the cycles either way basically, at least this way it’s optional. I don’t bother with a file indexer because with SSDs nowadays, find is pretty fast, and how often do you search for files anyway?

Linux has APIs to get notified on file system events (fanotify, inotify) which would allow such a service to update itself whenever files are created/delete immediately, but locate is way older than that, from the 80s. I think popular DEs have something like that.

There’s also ways to search for specific files that come with packages (e.g. dpkg -S), because the package manager already maintains an index of files that were installed by it, so you can use that for most stuff outside /home.

interdimensionalmeme@lemmy.ml on 04 Sep 16:57 collapse

I search for files dozens of times per day, it’s largely how I navigate between folders.
And often advanced searches like only this root folder, in reverse order of accessed time, or only folder
On windows I use void tools everything but nothing like it compares in speed and ease of use on linux.
It’s one of my many roadblock to transition to linux.

pitiable_sandwich540@feddit.org on 04 Sep 18:11 next collapse

Have you tried RTFM? :P

Jokes aside afaik you could do everything you mentioned with sort, find (with -type f, -printf and -mtime) and grep (filtering via regex with the -e flag).

Alternatively you could try KDE’s file explorer dolphin (or even just its search utility kfind) as a graphical alternative.

My point is switching to linux is not quick or easy, but there are few really impassable roadblocks (games with shitty kernel level anticheat for example) and there is a high likelyhood someone in this community has encountered your problems aswell and migjt even know a solution.

swelter_spark@reddthat.com on 04 Sep 19:11 next collapse

Nemo, Cinnamon’s file manager, also has great built-in search. I almost never feel the need to open up Catfish.

pitiable_sandwich540@feddit.org on 04 Sep 21:47 collapse

Yeah, i like nemo a lot, i use it on my main machine when i need a gui, because it has not as many dependencies as dolphin. And it does not feel as “bloated” as dolphin. It does one thing (be a file explorer) and does well. :)

interdimensionalmeme@lemmy.ml on 04 Sep 19:19 collapse

using find to sort all pictures in /pics/ by inverted (i.e., most recently accessed first) access time, and filtering only those with an exposure time between 1/20 and 1/100 seconds

find /pics/ -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) \
  -exec exiftool -ExposureTime -T {} \; -exec bash -c '
    file="$1"
    exposure="$2"

    # Convert exposure to decimal
    if [[ "$exposure" =~ ^([0-9]+)/([0-9]+)$ ]]; then
        num="${BASH_REMATCH[1]}"
        denom="${BASH_REMATCH[2]}"
        exposure_val=$(echo "$num / $denom" | bc -l)
    else
        exposure_val="$exposure"
    fi

    # Filter by exposure between 1/100 and 1/20 seconds
    if (( $(echo "$exposure_val >= 0.01" | bc -l) )) && (( $(echo "$exposure_val <= 0.05" | bc -l) )); then
        atime=$(stat -c %X "$file")  # Access time (epoch)
        echo "$atime $file"
    fi
  ' bash {} $(exiftool -s3 -ExposureTime {}) | sort -nr

In voidtools everything it would be

pic: path:“C:\pics” sort:da-descending ExposureTime:1/20…1/100

But actually doesn’t work because “ExposureTime” is only available as an sorting order not a filter but you get the gist ;)

pitiable_sandwich540@feddit.org on 04 Sep 21:00 collapse

Ah yeah okay, I see, that would be quite tedious to implement in bash. Everything looks pretty neat. :D

Buuut I just looked at KDE’s search framework filter options (used by dolphin if you press <crtl> + f ) and it seems it is indeed possible to search/filter by exposure time with dolphin or via directly in the cli.

interdimensionalmeme@lemmy.ml on 04 Sep 21:04 collapse

I have to try this !

gnuhaut@lemmy.ml on 04 Sep 18:34 next collapse

Seems like a good and useful workflow for sure. Don’t know if something equivalent exists, maybe it doesn’t.

I’d personally use find for this, but it is a command line tool, and while I have memorized some of the more common options (directories-only would be -type d for example), I’d have to look at the manpage for more advances options. It’s not hard exactly but it’s not easy-to-use GUI software for sure.

interdimensionalmeme@lemmy.ml on 04 Sep 18:40 collapse

I’ve taken to using chatgpt to make me the more advanced find queries, before on linux I would ONLY use find /path | grep -i somenames So that’s already an improvement, if still a bit tedious

The thing about everything is that it’s so ergonomic, fast and powerful.

Being able to search anything and sort everywhich way with the click of a button

Check out this sublime search syntax (this not even half of it ! )

<img alt="" src="https://lemmy.ml/pictrs/image/a47ab413-0188-4dce-a886-de530f5f2ef1.png">

And the re-ordering by columns, and there are just SO MANY columns you can add, like search by EXIF camera exposure, no problem !

<img alt="" src="https://lemmy.ml/pictrs/image/c17eaa99-21df-425e-b11e-d33bb71ee1e3.png">

I really wish there was something as good as “everything” on linux, it’s just awesome.

gnuhaut@lemmy.ml on 04 Sep 19:34 collapse

Oh that’s pretty cool! I does seem like a shame to not have something like that on Linux.

interdimensionalmeme@lemmy.ml on 04 Sep 19:37 collapse

Maybe it could run on something like wine ? But if there’s not something like… whatever it is that thing that makes WizTree faster than WinDirStat, then it would probably work in a very slow compatibility mode

gnuhaut@lemmy.ml on 04 Sep 19:45 collapse

Maybe? It’ll almost certainly be worse (or not work at all maybe) than on Windows.

MonkderVierte@lemmy.zip on 07 Sep 10:33 collapse

You might like fd. And bat. And generally awesome shell.

interdimensionalmeme@lemmy.ml on 07 Sep 10:37 collapse

Sounds good, I’m searching for a good shell function and alias repository

MonkderVierte@lemmy.zip on 07 Sep 10:39 collapse

Please tell if you find one, i would like to contribute.

interdimensionalmeme@lemmy.ml on 07 Sep 11:23 collapse

I wonder if the helper-scripts would allow something like that or if they’re proxmox scripts only ?

MonkderVierte@lemmy.zip on 07 Sep 10:25 collapse

Btw, there’s also
IFS=:; find $PATH -executable -iname “$1” -print
Speed advantages of a indexed DB don’t matter much anymore with nowadays hardware.