compgen is a useful command, and fish is an excellent command shell. But I cannot find an equivalent in fish.

I write one by myself:

function compgen --description 'Print a list of documented fish commands'
    bash -c "compgen $argv"

But I think it better to use the native one if any.


This is an exceptionally old question, but for future readers who stumble across this, the fish shell equivalent of bash's compgenbuiltin is complete -C. With -C option, complete will attempt to find all possible completions for the string specified immediately following -C, and, naturally, if you do not provide any additional characters after the -C, complete will, "... try to find all possible completions for the current command line buffer."

You can read about the the complete command and all of its options on the Fish Shell documentation page for this command.

Source: Fish Shell GitHub Issue #2105

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.