Ubuntu Linux Change IP Using Command Line Config File

Open terminal and type the following command:
sudo vi /etc/network/interfaces

OR
sudo gedit /etc/network/interfaces
Find eth0 section and setup IP address as follows:

auto eth0
iface eth0 inet static
address 192.168.2.1
netmask 255.255.255.0
network 192.168.2.0

broadcast 192.168.2.255Save and close the file. Once done, restart network:
$ sudo /etc/init.d/networking restart

Verify new IP address:
$ ifconfig eth0
$ ifconfig