Linux

Linux was originally developed as a free operating system for personal computers based on the Intel x86 architecture, but has since been ported to more computer hardware platforms than any other operating system. Because of the dominance of Android on smartphones, Linux has the largest installed base of all general-purpose operating systems. Linux, in its original form, is also the leading operating system on servers and other big iron systems such as mainframe computers and virtually all fastest supercomputers.

Linux is one of my favorite operating systems and it is, with the advent of spart phones and embedded device programming, now one of the most prolific operating systems around. On this page I want to present you with a few ways you can use Linux in your environment.

Example 1

Adding a new user.

useradd -u 32111 -g users -d /home/user01 -m -c "My First User" -s /bin/bash -p '$$1woeoiursjfDSKJHF$p3$1!@d#' linuser1

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.

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;

192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.128
10.0.0.0/8 dev eth0  scope link  metric 1002
default via 192.168.1.128 dev eth0

The above lists two network routes, one for the 192.168.1.0/24 network and one for the 10.0.0.0/8 network. It also lists a default route sending any other data to the 192.168.1.128 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 192.168.1.1/24 dev eth0

ip ro add 172.16.201.1/16 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 192.168.1.1/24 brd 192.168.1.255 scope global eth0
    inet 172.16.201.1/16 brd 172.16.201.255 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.