From man locate :
If --regex is not specified, PATTERNs can contain globbing characters. If any PATTERN contains no globbing characters, locate behaves as if the pattern were \*PATTERN*.
Therefore when you release
locate rhyth*
locate will not find it because there are no files that match this pattern: since the glob character is present there, locate will really try to match (in regex): ^rhyth.* and obviously there are no such matches (on full paths).
In your case, you can try:
locate "/home/sh/.local/share/rhythmbox/rhyth*"
or
locate '/rhyth'
But this is not very good, is it?
Now look at the first option in man locate :
-b,
Hooray! line:
locate -b "rhyth*"
should work the way you want: find a file with a match of the base name (in a regular expression): ^rhyth.*
Hope this helps.
Change . To answer your comment: if you want to locate all jpg files in the /home/sh/music/ folder, this should do:
locate '/home/sh/music/*.jpg'
(no -b here, this did not work). Please note that this will show all jpg files that are in the /home/sh/music folder, as well as in its subfolders. You may be tempted to use the -i flag (ignore case), so you will also find those that have an uppercase extension JPG:
locate -i '/home/sh/music/*.jpg'
Change 2 .. Better to say it somewhere: the locate command works with the database - why it can be much faster than find . If you have the latest files, they will not locate d, and if you delete some files, they may be locate d. If you are in this case (this may be the goal of your other comment), you should update the locate : database as root, issue:
updatedb
A warning. The updatedb command may take a few minutes, don't worry.