Re: dangling symlinks [ was: Re: "locate" easier to use than "find"]

2023-08-27 Thread tomas
On Sun, Aug 27, 2023 at 02:17:06PM -0400, Jeffrey Walton wrote:

[...]

> The symlink tool works great, too:
> 
> symlink -r / | grep dangling
> 
> You can also delete them, once you verify they are dangling:
> 
> symlink -r -d /
> 
> In fact, it is a recommended post-upgrade step for Fedora. See
> .
> 
> (I'm not arguing with you. I'm just responding to the title change).

Keep those arguments coming :-)

No, seriously. We're in here for learning. I didn't even know about
`symlink'. On the contrary: the more tools in the shop, the merrier.

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: dangling symlinks [ was: Re: "locate" easier to use than "find"]

2023-08-27 Thread Jeffrey Walton
On Sun, Aug 27, 2023 at 1:10 PM Jörg-Volker Peetz  wrote:
>
> to...@tuxteam.de wrote on 24/08/2023 14:00:
> >
> > A couple of days ago I was searching for dangling symlinks.
> >
> >find . -follow -lname "*"
> >
> How about
> find -L . -type l

The symlink tool works great, too:

symlink -r / | grep dangling

You can also delete them, once you verify they are dangling:

symlink -r -d /

In fact, it is a recommended post-upgrade step for Fedora. See
.

(I'm not arguing with you. I'm just responding to the title change).

Jeff



Re: dangling symlinks [ was: Re: "locate" easier to use than "find"]

2023-08-27 Thread tomas
On Sun, Aug 27, 2023 at 07:09:36PM +0200, Jörg-Volker Peetz wrote:
> to...@tuxteam.de wrote on 24/08/2023 14:00:
> > 
> > A couple of days ago I was searching for dangling symlinks.
> > 
> >find . -follow -lname "*"
> > 
> How about
>find -L . -type l

Should work, too.

Cheers
-- 
t


signature.asc
Description: PGP signature


dangling symlinks [ was: Re: "locate" easier to use than "find"]

2023-08-27 Thread Jörg-Volker Peetz

to...@tuxteam.de wrote on 24/08/2023 14:00:


A couple of days ago I was searching for dangling symlinks.

   find . -follow -lname "*"


How about
   find -L . -type l

Regards,
Jörg.




Re: "locate" easier to use than "find"

2023-08-24 Thread Greg Wooledge
> > to...@tuxteam.de (12023-08-24):
> > > Dunno. I use find nearly every day. Seeing it as "just a recursive
> > > grep" doesn't cover a fraction of its usefulness.
> > >
> > > A couple of days ago I was searching for dangling symlinks.
> > >
> > >   find . -follow -lname "*"

Wow... what a cryptic pair of options this is.  From the man page:

   -L Follow symbolic links.  When find examines or prints information
[...]
Using  -L  causes the -lname and -ilname
predicates always to return false.

And:

   The -follow option has a similar effect to -L, though it  takes  effect
   at  the  point where it appears (that is, if -L is not used but -follow
   is, any symbolic links appearing after -follow on the command line will
   be dereferenced, and those before it will not).

And:

   -follow
  Deprecated; use the -L  option  instead.   Dereference  symbolic
  links.   Implies -noleaf.  The -follow option affects only those
  tests which appear after it on the command line.  Unless the  -H
  or -L option has been specified, the position of the -follow op‐
  tion changes the behaviour of the -newer  predicate;  any  files
  listed  as  the  argument of -newer will be dereferenced if they
  are symbolic links.  The same consideration applies to -newerXY,
  -anewer and -cnewer.  Similarly, the -type predicate will always
  match against the type of the file that a symbolic  link  points
  to rather than the link itself.  Using -follow causes the -lname
  and -ilname predicates always to return false.

And:

   -lname pattern
  File is a symbolic link whose contents match shell pattern  pat‐
  tern.  The metacharacters do not treat `/' or `.' specially.  If
  the -L option or the -follow option is in effect, this test  re‐
  turns false unless the symbolic link is broken.

So that's two votes for "this can't possibly work" and one vote for
the opposite.  From within the same manual.  Yikes.

(And the POSIX manual doesn't help here, because -lname is a GNU extension.)



Re: "locate" easier to use than "find"

2023-08-24 Thread Nicolas George
Stanislav Vlasov (12023-08-24):
> Sometimes it's unexpected :-)

Then the shell prints an error and I try again. Still less time wasted
than these two mails.

Regards,

-- 
  Nicolas George



Re: "locate" easier to use than "find"

2023-08-24 Thread Stanislav Vlasov
чт, 24 авг. 2023 г. в 18:17, Nicolas George :

> > With a really large amount of files there will be overflow of process
> > environment (or too large cmdline).

> If I expect a very large amount of files, I can use it another way.

Sometimes it's unexpected :-)

-- 
Stanislav



Re: "locate" easier to use than "find"

2023-08-24 Thread tomas
On Thu, Aug 24, 2023 at 02:05:48PM +0200, Nicolas George wrote:
> to...@tuxteam.de (12023-08-24):
> > Dunno. I use find nearly every day. Seeing it as "just a recursive
> > grep" doesn't cover a fraction of its usefulness.
> > 
> > A couple of days ago I was searching for dangling symlinks.
> > 
> >   find . -follow -lname "*"
> 
> ls **/*(N@-@)
> 
> Zsh rulz.

Definitely. My point was rather to illustrate the kind of things
find can do that locate can't.

There is more than one way to do it (TM).

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: "locate" easier to use than "find"

2023-08-24 Thread Nicolas George
Stanislav Vlasov (12023-08-24):
> With a really large amount of files there will be overflow of process
> environment (or too large cmdline).

If I expect a very large amount of files, I can use it another way.

-- 
  Nicolas George



Re: "locate" easier to use than "find"

2023-08-24 Thread Stanislav Vlasov
чт, 24 авг. 2023 г. в 17:06, Nicolas George :
>
> to...@tuxteam.de (12023-08-24):
> > Dunno. I use find nearly every day. Seeing it as "just a recursive
> > grep" doesn't cover a fraction of its usefulness.
> >
> > A couple of days ago I was searching for dangling symlinks.
> >
> >   find . -follow -lname "*"
>
> ls **/*(N@-@)

With a really large amount of files there will be overflow of process
environment (or too large cmdline).
locate and find does not store filenames in memory.

-- 
Stanislav



Re: "locate" easier to use than "find"

2023-08-24 Thread Nicolas George
to...@tuxteam.de (12023-08-24):
> Dunno. I use find nearly every day. Seeing it as "just a recursive
> grep" doesn't cover a fraction of its usefulness.
> 
> A couple of days ago I was searching for dangling symlinks.
> 
>   find . -follow -lname "*"

ls **/*(N@-@)

Zsh rulz.

Regards,

-- 
  Nicolas George



Re: "locate" easier to use than "find"

2023-08-24 Thread tomas
On Thu, Aug 24, 2023 at 01:52:28PM +0200, Oliver Schoede wrote:

[...]

> Have basically stopped using traditional 'find' outside of scripts, as
> always thought I was about the last one [...]

Dunno. I use find nearly every day. Seeing it as "just a recursive
grep" doesn't cover a fraction of its usefulness.

A couple of days ago I was searching for dangling symlinks.

  find . -follow -lname "*"

did the trick.

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: "locate" easier to use than "find"

2023-08-24 Thread Oliver Schoede
On Mon, 21 Aug 2023 15:56:11 +0200
 wrote:

>On Mon, Aug 21, 2023 at 03:19:19PM +0200, Roger Price wrote:
>> On Mon, 21 Aug 2023, Hans wrote:
>> 
>> > find .mozilla -name favicons.sqlite -ls
>> >  1512492   2144 -rw-r--r--   1 myusername myusernama  2195456 Aug
>> > 21 13:29 .mozilla/firefox/gs0gkgv2.default/favicons.sqlite 1515049
>> >    260 -rw-r--r--   1 myusername myusername   262144 Aug 18 22:36
>> > .mozilla/firefox/th3dv2jy.default-1461749950404/favicons.sqlite
>> 
>> For me command "locate" is easier to use than "find":
>
>They do different things. Locate is much faster, but it only looks
>into file names. Find can do nearly everything, like looking into
>file metadata ("show me all files younger than 12 days" or "owned
>by www-data"), running external programs (e.g. grep), yadda, yadda.
>
>To each job its tool.
>
>Cheers

Have basically stopped using traditional 'find' outside of scripts, as
always thought I was about the last one. Replaced with 'fd-find' which
really is simpler/more intuitive, sometimes actually faster. Quite
typical case where ~20% of the functionality will be doing the trick
90% of the time, in less time, and to me that already looks more like
99%. Especially on single user systems. I'm feeling rather more sorry
to say it's the same with 'ag', better known as the silversearcher,
another one of those long-serving workhorses that by the way is slated
for being dropped from Debian in just a couple of days: no longer
maintained, long dead upstream. I've used it for heavy grepping about
everywhere and for so many years. Most obvious replacement in this case
apparently 'ripgrep', also Rust of course. Has a few more edges I find
a little weird but got comfortable in a matter of a days anyhow. It's
all similar enough, about the hardest part is getting the actual
commands right: never a big fan of aliases I still regularly type
'find' instead of 'fd', it's muscle memory. ;)

Meanwhile traditional (m)locate got itself replaced with plocate, it
wasn't always that fast! Old things go, new arrive, I'm still using
bash though. Sorry for going off on another tangent. If anyone is still
using 'ag', just consider the options. And yes, GNU 'find' is
overcomplicated, I've long made do with a couple of shell functions
just to fight the repetition.


Oliver



Re: "locate" easier to use than "find"

2023-08-21 Thread tomas
On Mon, Aug 21, 2023 at 06:45:16PM +0100, Brian wrote:

[...]

> plocate-updatedb.service and plocate-updatedb.timer take care of
> that for me. :)

I admit to accepting some help from trusty cron :)

> > Tools, jobs and that :)
> 
> Indeed.

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: "locate" easier to use than "find"

2023-08-21 Thread mick.crane

On 2023-08-21 17:21, to...@tuxteam.de wrote:

On Mon, Aug 21, 2023 at 02:50:07PM +, Michael Kjörling wrote:

On 21 Aug 2023 15:56 +0200, from to...@tuxteam.de:
>> For me command "locate" is easier to use than "find":
>
> They do different things. Locate is much faster, but it only looks
> into file names. Find can do nearly everything, like looking into
> file metadata ("show me all files younger than 12 days" or "owned
> by www-data"), running external programs (e.g. grep), yadda, yadda.

Another downside of locate is that it relies on its database being up
to date.

Depending on what you're trying to do, they may both be equally
useful, or one may be far more useful than the other.


Don't get me wrong. I /do/ use both, and take care that the locate
database is up-to-date.

Tools, jobs and that :)


When you imagine what it must be doing is amazing how quick updatedb is.

mick



Re: "locate" easier to use than "find"

2023-08-21 Thread tomas
On Mon, Aug 21, 2023 at 02:50:07PM +, Michael Kjörling wrote:
> On 21 Aug 2023 15:56 +0200, from to...@tuxteam.de:
> >> For me command "locate" is easier to use than "find":
> > 
> > They do different things. Locate is much faster, but it only looks
> > into file names. Find can do nearly everything, like looking into
> > file metadata ("show me all files younger than 12 days" or "owned
> > by www-data"), running external programs (e.g. grep), yadda, yadda.
> 
> Another downside of locate is that it relies on its database being up
> to date.
> 
> Depending on what you're trying to do, they may both be equally
> useful, or one may be far more useful than the other.

Don't get me wrong. I /do/ use both, and take care that the locate
database is up-to-date.

Tools, jobs and that :)

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: "locate" easier to use than "find"

2023-08-21 Thread Michael Kjörling
On 21 Aug 2023 15:56 +0200, from to...@tuxteam.de:
>> For me command "locate" is easier to use than "find":
> 
> They do different things. Locate is much faster, but it only looks
> into file names. Find can do nearly everything, like looking into
> file metadata ("show me all files younger than 12 days" or "owned
> by www-data"), running external programs (e.g. grep), yadda, yadda.

Another downside of locate is that it relies on its database being up
to date.

Depending on what you're trying to do, they may both be equally
useful, or one may be far more useful than the other.

-- 
Michael Kjörling  https://michael.kjorling.se
“Remember when, on the Internet, nobody cared that you were a dog?”



Re: "locate" easier to use than "find"

2023-08-21 Thread tomas
On Mon, Aug 21, 2023 at 03:19:19PM +0200, Roger Price wrote:
> On Mon, 21 Aug 2023, Hans wrote:
> 
> > find .mozilla -name favicons.sqlite -ls
> >  1512492   2144 -rw-r--r--   1 myusername myusernama  2195456 Aug 21 13:29 
> > .mozilla/firefox/gs0gkgv2.default/favicons.sqlite
> >  1515049    260 -rw-r--r--   1 myusername myusername   262144 Aug 18 22:36 
> > .mozilla/firefox/th3dv2jy.default-1461749950404/favicons.sqlite
> 
> For me command "locate" is easier to use than "find":

They do different things. Locate is much faster, but it only looks
into file names. Find can do nearly everything, like looking into
file metadata ("show me all files younger than 12 days" or "owned
by www-data"), running external programs (e.g. grep), yadda, yadda.

To each job its tool.

Cheers
-- 
t


signature.asc
Description: PGP signature


"locate" easier to use than "find"

2023-08-21 Thread Roger Price

On Mon, 21 Aug 2023, Hans wrote:


find .mozilla -name favicons.sqlite -ls
 1512492   2144 -rw-r--r--   1 myusername myusernama  2195456 Aug 21 13:29 
.mozilla/firefox/gs0gkgv2.default/favicons.sqlite
 1515049    260 -rw-r--r--   1 myusername myusername   262144 Aug 18 22:36 
.mozilla/firefox/th3dv2jy.default-1461749950404/favicons.sqlite


For me command "locate" is easier to use than "find":

rprice@titan ~ locate favicons.sqlite
/mnt/home/rprice/.mozilla/firefox/60mahk24.default-esr/favicons.sqlite
/mnt/home/rprice/.mozilla/firefox/60mahk24.default-esr/favicons.sqlite-wal
/mnt/home/rprice/.mozilla/firefox/sehco4n9.default/favicons.sqlite
/mnt/home/rprice/.mozilla/firefox/sehco4n9.default/favicons.sqlite-shm
/mnt/home/rprice/.mozilla/firefox/sehco4n9.default/favicons.sqlite-wal
rprice@titan ~ inxi -S
System: Host: titan Kernel: 5.10.0-15-amd64 x86_64 bits: 64 Desktop: Xfce 
4.16.0 Distro: Debian GNU/Linux 11 (bullseye)

Roger