How to Compile C Language Program in Ubuntu Linux

Posted by in Articles, C++, Programming

Are you a student or first time to learn C Language and you currently using in Microsoft Windows “Turbo C” compiler to compile c program? Are you want to run Ubunu (Linux) but, you don’t have any idea about how to compile C Programs in Linux. How to create c program in Linux/Ubuntu? So, here we are giving step to step tutorial about how to compile “C Language” Program in Ubuntu Linux.

To Compile C Language Program in Linux/Ubuntu as first open terminal in Linux. For that, goto Applications – Accessories – Terminal

Then, type in Terminal- gedit Filename.c

For example- gedit Clanguage.c

Then, press enter key from your keyboard. After this, a Simple Text Editor will open as named Clanguage.c as illustrated in figure —>

In text editor then, write your c Language code. Visit figure-

Then, click on save button to save your c language file. Save it where you want.

And then, close your text editor as you will back to terminal.

Then, type in Terminal following commands to execute your c language program (code) which is in file named Clanguage.c.


gcc -c language.c (to type this command you will get ouput file of Clanguage.c file)

gcc Clanguage.c -o Clanguage (to type this command you will get an executable file)

Finally type-


Visit figure for best help—

So, in this way you can create and execute all of your c language programs in Ubuntu/Linux. Try it today…