I want to code using C++. How can I run my program using the terminal? It shows the following message.

GCC: command not found


closed as too broad by jasonwryan, G-Man, thrig, Stephen Rauch, Satō Katsura Oct 29 '17 at 6:30

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. 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.


If you are trying to compile your code with gcc, you need to use gcc as the command. Commands in bash are case sensitive.


Bash, like other Linux shells, is case sensitive: GCC is not the same as gcc, and you want to use gcc.

If even gcc doesn't work, it means:

  • You didn't install it, which you should do with the following commands.

    sudo apt-get install build-essential
    sudo apt-get install gcc
  • The command is not in your $PATH. In this case try first env | grep path, and then gcc hello.c -o hello1. If it doesn't work, find where gcc is with find . -name gcc, and add its path with export PATH=$PATH:/path/to/gcc. (Replace /path/to/gcc with the path where gcc was find with the previous command.)

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