you're reading...
C, GNU/Linux, Programming, Ubuntu

GNU Indent – beautify C code !!

Wanna beautify your C program without having to go through the hassle of manual Indentation of the code??

Then The GNU Indent program is here to make your work easy 🙂 ….

The GNU Intend program changes the appearance of a C program by inserting or deleting white space .

>>First Step – Installing Indent on your GNU/Linux system (in my case its ubuntu)

Go to Terminal and issue the following command

$ sudo apt-get install indent

Now intend is installed ..

>>Second Step – Writing a simple piece of unindented code using your favorite editor ( in my case gedit )

$ gedit howdy.c

#include <stdio.h>
int main()
printf ("This is a demo of GNU Indent\n");
return 0;

>>Third Step – Indenting!!

$ indent howdy.c

Now open the file howdy.c

$ cat howdy.c
#include <stdio.h>

main ()
 printf ("This is a demo of GNU Indent\n");
 return 0;

Now the program has been properly indented …if u wanna see the previous version of the program then use the command

$ cat howdy.c~

This tool is a very powerful one…. more about its abilities in the coming posts 🙂

More information on GNU Indent can be found here and its complete manual here


(Information for the post gathered mainly from joysofprogramming and from many other sources)


About Suhas Dwarakanath

Embedded Engineer interested in Electronics and GNU/Linux


No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: