Fd: Show symlink target?

Created on 16 Sep 2019  Â·  11Comments  Â·  Source: sharkdp/fd

Thanks for making fd. I love it and I've been using it heavily for about a year.

I was wondering if it was possible to display the targets of symlinks for commands like:

fd --type l

I couldn't find anything in the documentation about this, but it would be a nice addition.

help wanted

Most helpful comment

In #556, I have implemented a new -l/--list-details option which can be used to show symlink targets:

image

@wpcarro @danielecook I hope that's fine for your use case.

All 11 comments

I think you could do that with --exec readlink or similar

Thanks. I didn't know about exec.

I still think it might be nice to support it internally and not via exec. The syntax coloring of links is nice and a view like target -> source could be useful for some people.

Thank you for the feedback.

I kind of like the idea, but it should be discussed first.

It would certainly only be enabled in "interactive" mode (when not piping the output elsewhere).

I see one obvious disadvantage of this behavior. If someone wants to "copy & paste" a list of found files from fds output, it would also include the … -> source part.

I would like to vote for this feature. I use fd to track down sequencing data which is unfortunately symlinked often making it difficult to get the absolute paths and a unique set of files. If there was an option to resolve symlinked paths to their real paths that is faster than --exec readlink I would very much appreciate it.

see also: #491

In #556, I have implemented a new -l/--list-details option which can be used to show symlink targets:

image

@wpcarro @danielecook I hope that's fine for your use case.

This fits my use-case exactly. Thank you, @sharkdp

This has now been released in fd v8.0.

so my .gitignore ignores a few build temporary dirs, but I need find files there once a file, fd will quietly ignore them, and I have to return to 'find'.

is there a way to set a local file that has higher priority than .gitignore, say .gitfd, that once it's there, fd will prefer it to .gitignore.

.gitignore is for git to manage code(commit or not), but fd should do more, and could we have a way to do that like described above?

@laoshaw you tell fd to ignore the .gitignore file altogether with the --no-ignore-vcs option.

If you just want exceptions to .gitignore, you can add a negated rule to your .fdignore file. So, say if you have foo/ in your .gitignore, you could put !foo/ in you .fdignore to add it back to fd searches.

But also, what does this have to do with showing symlink targets?

That works. Nothing to do with symlink, it's when I could not find the symlinks in a directory I first thought it's because fd can not do symlinks, then realized it's because of .gitignore has that directory. Thanks.

Was this page helpful?
0 / 5 - 0 ratings