Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I know the Linux distribution of the command?

For example, lscpu command

Is there any place with a matrix (distribution, commands)?

share|improve this question

closed as unclear what you're asking by slm, Hauke Laging, Braiam, jasonwryan, Renan Mar 1 at 1:19

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Is your question about finding out the name of the current distribution or the commands available at some distribution? –  michas Feb 28 at 21:54
3  
@NlightNFotis, I really don't agree with you editing the question to suit your interpretation. I think that is shocking, it should be for the OP to clarify. –  Graeme Feb 28 at 22:22
    
@Graeme I don't know what you find shocking about it, I only made it's meaning more clear. Anyway, that's why I said, roll it back if you disagree. I'm curious however, what is your intrepretation of the question? –  NlightNFotis Feb 28 at 22:26
    
@Michel, are you trying to determine if a particular command is present on the system or are you trying to use a command to determine which distribution you are on? –  Graeme Feb 28 at 22:26
    
Let's determine what the OP wants before we lock in on our answers and then shape the Q to suite it. Minor adjustments are fine but leave a comment if you're unclear which way to skew the Q. –  slm Feb 28 at 22:28

3 Answers 3

Very few commands are distribution specific.

Each command is contained in some package, which might be installed or not.

Which packages are installed can be choosen when installing and later additional packages can be added or removed.

Therefore two boxes running the same distribution can provide a very different set of commands.

share|improve this answer

This command is probably what you are looking for:

lsb_release -a

Since lsb stands for 'Linux Standard Base', it is reasonable to expect this to be present.

http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/lsbrelease.html

share|improve this answer
    
-1. How does this answer the op's question? The op is asking if there is a way to find out if a particular binary is on his system. lsb_release prints details about the particular distribution, such as its codename, etc. Apart from that, even if you check out your lsb version against the online specifications, you still may be missing out on extra binaries that are not present in the lsb specification. Not to mention that this command isn't omnipresent. My fedora 19 box doesn't have it. –  NlightNFotis Feb 28 at 22:04
    
@NlightNFotis Ok, this question is ambiguous, my interpretation comes from this part 'How can I know in which linux distribution is present'. Notice that while I still think mine is correct, it is not accompanied with a downvote. I was only asking why you think otherwise. –  Graeme Feb 28 at 22:10
    
dude, please, don't take it personally. I don't downvote out of malice or revenge or anything. I downvote questions that I perceive to contain wrong or irrelevant information. In that spirit, if you consider my answer to contain wrong/irrelevant information, please downvote it to oblivion. –  NlightNFotis Feb 28 at 22:16
    
The question is absolutely unclear and should be edited to at least be grammatically correct so as to not elicit such confusion. –  DopeGhoti Feb 28 at 22:16
    
@DopeGhoti There, I edited the question to what I perceive the op wants. If you think my interpretation is wrong, please rollback the edit. –  NlightNFotis Feb 28 at 22:20

You could always attempt to run the command in your shell of choice. If the command is present, it will be executed. If it's not present, the shell will output something along the lines of:

bash: lelos: command not found...

Keep in mind that certain binaries may not be able to be found, unless you attempt to execute them as root user, or with root privileges (via sudo for instance)

Apart from that, you can use which. which is a software that searches your $PATH for what was given as input, and if the executable is present it will output something like

[23:51:20] nlightnfotis@mars : [~] $ which gcc
/usr/bin/gcc

If the command isn't there, it will output either nothing or something along the lines of:

/usr/bin/which: no <command> in $PATH

Keep in mind that this is not 100% reliable, as which only searches in your $PATH environment variable, and it may miss executables not located in one of the folders described in it.

share|improve this answer
    
Nice, but how does any of this determine the distro? –  Graeme Feb 28 at 22:01
    
@Graeme It doesn't. The op's question isn't about what distro he is running. It's about how he can find out if a particular command (binary) is available at his system. –  NlightNFotis Feb 28 at 22:05
1  
Btw, just to be clear, it wasn't me that downvoted this. Honestly I think its mad if we all downvote each other because we have different interpretations of a poorly asked question. –  Graeme Feb 28 at 22:31
    
@Graeme Even if it was you, that would be totally ok with me. I'm not here for rep hunting, I'm here to help and get helped. In that spirit, I will say again, that if you consider my answer not helpful please downvote it. –  NlightNFotis Feb 28 at 22:33

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