If you see Bash: GCC Command Not Found, first check the exact command you typed. On Linux, command names are case-sensitive, so uppercase GCC and lowercase gcc are different commands. The normal compiler command is lowercase gcc.
command -v gccgcc --version
If those work, GCC is installed and the issue was the command spelling or the build command using uppercase letters.
If lowercase gcc is still missing
Remember that a virtual machine has its own packages. GCC installed on the host does not automatically exist inside the Linux guest. On Ubuntu, the official GCC setup guide says the gcc package provides the platform’s default C compiler and shows installation with sudo apt install gcc g++.
- Ubuntu/Debian: refresh package metadata if needed, then install
gccandg++. If you needmakeand common headers too, install the distribution’s build tools package such asbuild-essential. - Fedora/RHEL family: use the matching
dnfcommand or development-tools group for that distribution. - Arch family: use
pacmanand the base development packages.
Do not run a full system upgrade just because one command is missing. Install the missing compiler package with the package manager for that distribution, then verify again with command -v gcc.
PATH and custom compiler installs
If GCC was built manually or installed under /opt, the binary might exist but not be in PATH. Search only where appropriate:
find /usr /usr/local /opt -name gcc -type f 2>/dev/null
If you intentionally built GCC from source, use the upstream GCC installation documentation and add the chosen bin directory to PATH. For a normal Linux VM, distribution packages are usually safer than a manual source build.
Safe compile test
Use a unique temporary directory so you do not overwrite an existing hello.c:
tmpdir=$(mktemp -d) || exit 1
cd "$tmpdir" || exit 1
cat > hello.c <<'EOF'
#include <stdio.h>
int main(void) { return 0; }
EOF
gcc hello.c -o hello
./hello
cd -
rm -rf "$tmpdir"If this compiles, the compiler is callable. It does not prove that every other program will build; later failures can still come from missing libraries, headers, Makefiles, or project-specific options.