Basics - Bash Commands

Is there a way to know which package these commands belong to?

  • find is in findutils
  • tar in coreutils
  • cd? xargs? etc?

Some heuristic?

I must be missing something… I am writing a line of bash for a service, therefore I think I need the package info.

Thanks!

Best tool for that is https://github.com/bennofs/nix-index IMO.

3 Likes

If you just want to know for yourself and not for programmatic reasons this is low tech but works well enough:

ls -l $(which find)

This will return you the store path with which you can infer the name.

2 Likes

really nice - any idea how to find cd?

I thought cd isn’t a program, but a command implemented in shells.

1 Like

ahhh, i never knew! thanks for this

The type builtin can discriminate between external commands and shell builtins/functions/aliases/etc. You can also use type -a <cmd> to see all commands an invocation could resolve to.

1 Like

command-not-found or nix-locate

1 Like