C Programming Language

C is a general-purpose, high-level language that was originally developed to write an operating system called UNIX. The UNIX operating system, the C compiler, and essentially all UNIX application programs have been written in C. C has now become a widely used professional language for various reasons including its ability to handled low level functions, cross platform capabilities and the fact that it is a fairly easy language to learn with a minimal ammount of keywords to learn.

C is one of my favorite programming languages, having written in several languages, I always find myself coming back to C to carry out some function that I am unable to complete in the target language or for speeds sake. In regards to C, you will likely not find a faster programming code outside of Assembly.

Example 1

The Hello World Application.

In the above, the useradd is used to add a new user to the local system.

The -u parameter specified the user id assigned to the user. Note that if the -u is not specified, then the next available user id number will be assigned.

The -g parameter specifies the users primary group. Note that any group specified, where using the -g or the -G parameters, the group name must already exist.

The -d parameter is used to specify the new users home directory.

The -m parameter indicates that the home directory should be created if it does not exist.

The -c parameter is used to provide a freeform comment. This must be enclosed in double quotes if more than a single word.

The -s parameter specified the users shell, normally the default for this is /bin/[ba]sh.

The -p parameter is used to provide a pre-encrypted password hash value. This must match the users entered password when it is encrypted.

Following all of the above, enter the desired user name, this name must not exist or an error will be generated.

Example 2


Iproute2 is a collection of utilities for controlling TCP / IP networking and traffic control in Linux.

Most network configuration manuals still refer to ifconfig and route as the primary network configuration tools, but I find the IProute2 package to be infinitely better in its form and flexability.

ip ro ls

In the above, ip is the IProute2 binary used to view and manipulate the routing tables, and many other things as well. ro is short for route and indicates the sub command interface of ip we are accessing.

The ls is short for list which is the parameter for the sub command route.

Executing the above command will yield output similar to the following; dev eth0  proto kernel  scope link  src dev eth0  scope link  metric 1002
default via dev eth0

The above lists two network routes, one for the network and one for the network. It also lists a default route sending any other data to the router via ethernet interface eth0.

Another nice feature of IProute2, is the ability to have multiple ip addresses assigned to the same interface. When using ifconfig you have to create a virtual interface such as eth0:1 and assign an address to that, in IProute2, all you do is add another ip.

ip ro add dev eth0

ip ro add dev eth0

Entering the command;

ip addr ls dev eth0

will result in the following output, or similar;

2: eth0:  mtu 1500 qdisc mq state UP qlen 1000
    link/ether 32:32:32:32:32:32 brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
    inet brd scope global eth0
       valid_lft forever preferred_lft forever

I really cannot stress enough that you want to learn IProute2 as it will make your life so much easier.