Linux Know-How provides a collection of introductory texts on often needed Linux skills.


gcc filename.c

GNU C compiler. Quite straight-forward if you know C. Extensive free manuals are available on the net.

How do I compile a simple C program?

Start your favourite text editor and type in your source code. For example, I may use pico:

pico hello.c

and type in the Kerningham and Richie (the creators of "c") intro example of a C program:

#include <stdio.h>

void main(void) {

printf("hello world\n");


I save the file and then invoke the GNU C compiler to compile the file "hello.c":

gcc hello.c

The gcc compiler produces an executable binary file "a.out", which I can run:


Last Update: 2010-12-16