Linux Find Out What Compilers Are Installed or Available On The System

in Categories last updated December 11, 2017

How do I find out what compilers are installed on a Debian / Ubuntu / Red hat Enterprise / CentOS Linux operating systems? How do I list all available compiler packages under a Linux operating system using the CLI?

GCC is an Acronym for “GNU Compiler Collection”. It is a collection of compilers for C, C++, Fortran and other tools. GCC compiler is also used for building the Linux kernel and the same one is ships as standard on most GNU/Linux based systems.

You can query your package database for installed compiler set under Linux operating systems.

Command for Debian / Ubuntu Linux users

Type the following dpkg command to see installed compilers and version:
$ dpkg --list | grep compiler
Sample outputs:

ii  g++                                      4:4.4.5-1                          The GNU C++ compiler
ii  g++-4.4                                  4.4.5-8                            The GNU C++ compiler
ii  gcc                                      4:4.4.5-1                          The GNU C compiler
ii  gcc-4.3                                  4.3.5-4                            The GNU C compiler
ii  gcc-4.4                                  4.4.5-8                            The GNU C compiler

To list all available compilers that can be installed, enter apt-cache command:
$ apt-cache search Compiler
$ apt-cache search Compiler | grep -i --color java
$ apt-cache search Compiler | grep -i --color fortran

Sample outputs:

libsidl-1.4.0 - Scientific Interface Definition Language (SIDL) C(++)/FORTRAN runtime
libsidl-dev - Scientific Interface Definition Language (SIDL) C(++)/FORTRAN runtime devel
libetsf-io-dev - Static libraries and Fortran module files of ETSF_IO
f2c - A FORTRAN 77 to C/C++ translator
ftnchek - A semantic checker for Fortran 77 programs
fweb - A literate-programming tool for C/C++/Fortran/Ratfor
gfortran-4.3-multilib - The GNU Fortran 95 compiler (multilib files)
gfortran-4.3 - The GNU Fortran 95 compiler
gfortran-4.4-multilib - The GNU Fortran 95 compiler (multilib files)
gfortran-4.4 - The GNU Fortran 95 compiler
gfortran-multilib - The GNU Fortran 95 compiler (multilib files)
gfortran - The GNU Fortran 95 compiler
gfortran-doc - documentation for the GNU Fortran Compiler (gfortran)
gfortran-4.1-doc - documentation for the GNU Fortran Compiler (gfortran)
gfortran-4.2-doc - documentation for the GNU Fortran Compiler (gfortran)
gfortran-4.3-doc - documentation for the GNU Fortran Compiler (gfortran)
gfortran-4.4-doc - documentation for the GNU Fortran Compiler (gfortran)

Use the apt-get command to install compiler under Debian / Ubuntu Linux:
$ sudo apt-get install gfortran

Command for Red Hat / RHEL / CentOS / Fedora Linux users

Type the following yum command to list all installed compiler:
$ yum list installed | grep -i --color compiler
$ yum list installed | grep -i --color gcc
$ yum list installed | grep -i --color java
$ yum list installed gcc
$ yum list installed 'gcc*'

Sample outputs:

Loaded plugins: auto-update-debuginfo, product-id, protectbase, rhnplugin, subscription-manager
Updating certificate-based repositories.
0 packages excluded due to repository protections
Installed Packages
gcc.x86_64                                                          4.4.6-4.el6                                                          @rhel-x86_64-server-6

To search all available compiler, run:
$ yum search all compiler
However, I recommend the following command to list all development tools under RHEL and friends:
$ yum groupinfo "Development tools"
Sample outputs:

Loaded plugins: auto-update-debuginfo, product-id, protectbase, rhnplugin, subscription-manager
Updating certificate-based repositories.
Setting up Group Process

Group: Development tools
 Description: A basic development environment.
 Mandatory Packages:
   autoconf
   automake
   binutils
   bison
   flex
   gcc
   gcc-c++
   gettext
   libtool
   make
   patch
   pkgconfig
   redhat-rpm-config
   rpm-build
 Default Packages:
   byacc
   cscope
   ctags
   cvs
   diffstat
   doxygen
   elfutils
   gcc-gfortran
   git
   indent
   intltool
   patchutils
   rcs
   subversion
   swig
   systemtap
 Optional Packages:
   ElectricFence
   ant
   babel
   bzr
   ccache
   chrpath
   clips
   clips-devel
   clips-doc
   clips-emacs
   clips-xclips
   clipsmm-devel
   clipsmm-doc
   cmake
   cmucl
   colordiff
   compat-gcc-34
   compat-gcc-34-c++
   compat-gcc-34-g77
   cvsps
   darcs
   dejagnu
   email2trac
   expect
   ftnchek
   gcc-gnat
   gcc-java
   gcc-objc
   gcc-objc++
   ghc
   git
   haskell-platform
   imake
   jpackage-utils
   kdewebdev
   libstdc++-docs
   lua
   mercurial
   mock
   mod_dav_svn
   nasm
   nqc
   nqc-doc
   ocaml
   perltidy
   python-docs
   qgit
   rpmdevtools
   rpmlint
   sbcl
   systemtap-sdt-devel
   systemtap-server
   trac
   trac-git-plugin
   trac-mercurial-plugin
   trac-webadmin
   translate-toolkit

Use the yum command to install compiler under RHEL / CentOS:
# yum install gcc
OR for the latest version of a CentOS/RHEL 7 try the following command to install compiler collection:
# yum group install "Development Tools"

This entry is 11 of 13 in the Linux GNU/GCC Compilers Tutorial series. Keep reading the rest of the series:
  1. Ubuntu Linux Install GNU GCC Compiler and Development Environment
  2. Debian Linux Install GNU GCC Compiler and Development Environment
  3. CentOS / RHEL 7: Install GCC (C and C++ Compiler) and Development Tools
  4. Download and Install C, C++ Compiler on Red Hat Enterprise Linux 5 (RHEL)
  5. Mac OS X: Install GCC Compiler with Xcode
  6. Where is My Linux GNU C or GCC Compilers Are Installed?
  7. HowTo: Compile And Run a C/C++ Code In Linux
  8. RHEL / CentOS Linux Install Core Development Tools Automake, Gcc (C/C++), Perl, Python & Debuggers
  9. HowTo Compiling C Program And Creating Executable File Under a Linux / UNIX / *BSD
  10. How To Install ncurses Library on a Linux
  11. Linux Find Out What Compilers Are Installed or Available On The System
  12. Linux Find Out GNU gcc Compiler Version Used To Compile Running Kernel
  13. Howto see output of C program in Linux or UNIX

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Share this on (or read 2 comments/add one below):

2 comment

  1. when ever i try to install X-crysden i found one massage:
    E: Encountered a section with no Package: header
    E: Problem with MergeList /var/lib/apt/lists/extras.ubuntu.com_ubuntu_dists_precise_main_binary-i386_Packages
    E: The package lists or status file could not be parsed or opened.
    please suggest me how to install xcrysden in ubuntu

    Have a question? Post it on our forum!