Is there a way to check what programming languages are installed on a given Linux system?

For example, I have recently installed Arch Linux on my host and just for informational purposes I would like to know/generate a list of all programming languages which come pre-installed on the system along with their version.

I have been doing it in a trial and error way manually on terminal like

python -V
perl -v
ruby -v

etc. I am sure there has to be a better way than what I am doing to find out this information.

I need to generate a list of programming languages installed on Arch Linux distribution.

  • 1
    As far as I know there is no better way than trying all possible #!/usr/bin/env lang (possible from a preset list of all existing languages). Actually, I would also like to know whether there is a better way.
    – ddnomad
    Jun 17 '17 at 15:05
  • Would these be languages only installed by a package manager, or would you want to account for languages potentially installed in a different fashion? For example, Java may have a .tar.gz downloaded and extracted in a user's home directory.
    – KevinO
    Jun 17 '17 at 15:06
  • @KevinO To keep it very simple and bare-bone (like arch philosophy XD ) information on default/ compilers shipped with destro would be sufficient. System wide languages installed at their default paths. Jun 17 '17 at 15:16
  • 7
    I doubt that this is a well defined task. Does bash count as a script programming language and would you count it different from ksh or csh. How do you count python 2.x vs. python 3.x. Are Maple and R programming languages. What about ant buildfiles or Maven? What is awk? What is sed or even tr? There are so many ways in which software reads text input and acts differently depending on what it reads that the difference between programming language and configurable program is probably not well defined.
    – Harald
    Jun 17 '17 at 15:35
  • I had this same question in the past. It happens when you're in a locked environment (ex. work computer), and has to live off what is already installed.You can get a quite comprehensive list with "apropos scripting interpreter compiler programming" in the terminal.
    – ksousa
    Jul 25 '20 at 20:02

There is no simple way to do this. As far as pacman is concerned, programming languages are just packages like any other. So you are essentially asking for a filtered list of packages; and it is up to you to delimit what constitutes a programming language.

Having said that, it can be bruteforced, by parsing pacman, or in this case expac's, output.

    for l in $(expac -Q '%n' | awk '/^ruby$/||/^python$/||/^lua$/||/^haskell$/');\
       do eval "$l" --version; done
    Python 3.6.1
    ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
pacman -Ss | grep multilib | grep installed

This a great way it will list all softwares or languages installed.

  • 1
    Why would this report programming languages? What definition of “programming language” are you using? Jun 17 '17 at 19:41
  • This searches the sync database, ie., all possible packages, not locally installed ones, so it is even less applicable/relevant.
    – jasonwryan
    Jun 17 '17 at 20:06

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