Answer the question
In order to leave comments, you need to log in
How to get a list of all Linux programs?
Good afternoon! I write shell. You need to make an addition (hints when you press the tab). But I do not know where to get the list of commands / programs.
Somewhere there is probably a folder or file with the name of the programs. Where can I get such a list from a program written in C?
Maybe I'm looking in the wrong direction and there's a better way to implement additions. If that's the case, then I'd love some advice.
Answer the question
In order to leave comments, you need to log in
echo $PATH
/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
If you're writing a POSIX-compliant shell, you can just include bash-completion or see how it's organized.
And so - auto-completion is done not according to a specific list, but according to what is in the directories listed in the PATH variable
Tip: take the source of the shell that is taken as a sample and see how it is done in it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question