How To Install GNOME Desktop Environment in Ubuntu 14.04


Introduction:


Desktop Environment is a Graphical User Interface (GUI). It  help us to easily access different application, edit files, display time, many other things we often use from desktop. 

After installing Ubuntu 14.04 or any other ubuntu version the default desktop environment would be unity. It looks nice but it is bit slow for less hardware. There is many other desktop environment available like XFCEGNOME, LXDE, etc., available and it is very easy to install. This article gives you how to install GNOME desktop in UBUNTU.

Open the Terminal using Ctrl + Alt + T or any other way you like


Step 1Update the System

        sudo apt-get update                                   

Step 2
Install gnome shell

        sudo apt-get install gnome-shell                      

Step 3: Install gnome desktop environment


        sudo apt-get install ubuntu-gnome-desktop             

Step 4: Logout from current session.

Step 5: Select the desktop type from login screen. Desktop Selection button  available just above the password box in login screen. Below images shows how to select desktop

(i) Click on the icon (Ubuntu symbol) right near to the user name





(ii) Select GNOME(Desktop) from list and then login 



Step 6: If it not worked properly then try it after restarting the Computer.

Enjoy !!!


Writing Your First Kernel Module Programming In Linux

Introduction :

Kernel module is the piece of code which extent the functionality of the linux kernel, without recompiling full kernel and not even doing any reboot.

This kernel module can be loaded and unloaded on demand. Kernel module will not run in user space instead it will run in kernel space.

Initial setup to compile kernel module:

To compile and run kernel module we need to have linux kernel header. Installing linux kernel header will vary on different linux distros.

Below command used to install kernel header for Centos 6.5. This command is same for redhat and fedora and its variant.

yum install kernel-devel

you can see the installed kernel header in /usr/src/kernels directory.



If we want to learn any new programming language we always go for Hello world program. So here i going to explain how to compile and run Hello World kernel module program.

Writing module program is different than user space program. Because in user space C program start at main() but it is not module programming.

There is two function called init_module() and cleanup_module(). This init_module() function will called when module inserted into the kernel. similarly cleanup_module will be called when module unloaded from the kernel. I will demonstrate this later.


hello.c

#include <linux/module.h> /* It used for all modules */
#include <linux/kernel.h> /* It used for KERN_INFO */

int init_module(void) /* Called when insmod */
{
printk (KERN_INFO "Hello World\n");
return 0;
}

void cleanup_module(void) /* Called when rmmod */
{
printk (KERN_INFO "Bye Bye\n");
}

We need to write the make file for making compilation in easy manner


Makefile:

obj-m += hello.o

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

Now we have written kernel module C program and Makefile for compilation

[root@localhost hello]# ls -l
total 8
-rw-rw-r--. 1 sujin sujin 301 Aug 17 17:08 hello.c
-rw-rw-r--. 1 sujin sujin 156 Aug 17 16:57 Makefile


To compile module program simple run make command in directory where hello.c and Makefile available.

[root@localhost hello]# make
make -C /lib/modules/2.6.32-431.23.3.el6.x86_64/build M=/home/sujin/kernel_dev/module/hello modules
make[1]: Entering directory `/usr/src/kernels/2.6.32-431.23.3.el6.x86_64'
  CC [M]  /home/sujin/kernel_dev/module/hello/hello.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/sujin/kernel_dev/module/hello/hello.mod.o
  LD [M]  /home/sujin/kernel_dev/module/hello/hello.ko.unsigned
  NO SIGN [M] /home/sujin/kernel_dev/module/hello/hello.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.32-431.23.3.el6.x86_64'


Now you will see the file called hello.ko in directory where you compiled the module.

[root@localhost hello]# ls -l
total 308
-rw-rw-r--. 1 sujin sujin   301 Aug 17 17:08 hello.c
-rw-r--r--. 1 root  root  95415 Aug 17 17:18 hello.ko
-rw-r--r--. 1 root  root  95415 Aug 17 17:18 hello.ko.unsigned
-rw-r--r--. 1 root  root    818 Aug 17 17:18 hello.mod.c
-rw-r--r--. 1 root  root  54816 Aug 17 17:18 hello.mod.o
-rw-r--r--. 1 root  root  42210 Aug 17 17:18 hello.o
-rw-rw-r--. 1 sujin sujin   156 Aug 17 16:57 Makefile
-rw-r--r--. 1 root  root     52 Aug 17 17:19 modules.order
-rw-r--r--. 1 root  root      0 Aug 17 17:18 Module.symvers

Insert the kernel module using insmod. insmod command will call init_module() function from program. You should be sudo user to insert module to the kernel

[root@localhost hello]# insmod hello.ko

You can see the installed kernel module using lsmod command
[root@localhost hello]# lsmod | head
Module                  Size  Used by
hello                    892  0
ipt_addrtype            2153  2
xt_conntrack            2776  1
ipt_MASQUERADE          2466  1
iptable_nat             6158  1
nf_nat                 22759  2 ipt_MASQUERADE,iptable_nat
bridge                 83689  0
dm_thin_pool           46566  1
dm_bio_prison           6346  1 dm_thin_pool


It is not possible to see the output of printk in terminal, because module loaded in kernel space not in user space. Instead kernel put printk output in logfile, you can see those message from log file using dmesg command.

[root@localhost hello]# dmesg | tail
SELinux: initialized (dev cgroup, type cgroup), uses genfs_contexts
SELinux: initialized (dev cgroup, type cgroup), uses genfs_contexts
Bridge firewalling registered
8021q: adding VLAN 0 to HW filter on device docker0
SELinux: initialized (dev fuse, type fuse), uses genfs_contexts
eth0: no IPv6 routers present
docker0: no IPv6 routers present
hello: module license 'unspecified' taints kernel.
Disabling lock debugging due to kernel taint
Hello World

By using rmmod command you can remove the module from kernel. It will call the cleanup_module() function in the module program

[root@localhost hello]# rmmod hello

Now you can see the cleanup message from logfile using dmesg command.

[root@localhost hello]# dmesg | tail
SELinux: initialized (dev cgroup, type cgroup), uses genfs_contexts
Bridge firewalling registered
8021q: adding VLAN 0 to HW filter on device docker0
SELinux: initialized (dev fuse, type fuse), uses genfs_contexts
eth0: no IPv6 routers present
docker0: no IPv6 routers present
hello: module license 'unspecified' taints kernel.
Disabling lock debugging due to kernel taint
Hello World
Bye Bye


That's it !!! Well done. Finally we done hello world kernel module programming.

I am not the owner of this article. I grabbed details from other articles. Full credits goes to author of The Linux Kernel Module Programming Guide.


Enjoy Linux


   
   





How to Install VMware Player in UBUNTU 14.04 LTS


step 1:

download vmware player freely from vmware official site.

DOWNLOAD VMWARE PLAYER FREE

setp 2:

open the terminal using (ctrl + alt + t). move to the directory where vmware player downloaded. mostly it will available in Download directory.

step 3:

Check the downloaded file check sum with checksum value available in vmware site.

vmware website give checksum

  • Contains VMware Player for Linux 64-bit operating systems.
  • VMware-Player-6.0.3-1895310.x86_64.bundle
  • 1895310
  • 2014-07-01
  • MD5SUM: 73113d30ddb222e1a690d23ac569e462
    SHA1SUM: c6576184a76aa65c69313d973c551ddac432408e

Check the md5 check sum using md5sum command

sujin@sujin:~/Installers$ md5sum VMware-Player-6.0.3-1895310.x86_64.bundle
73113d30ddb222e1a690d23ac569e462  VMware-Player-6.0.3-1895310.x86_64.bundle



In my case both are same. so i can make sure that it was downloaded successfully.


Step 4:

give the executable permission to the file

sujin@sujin:~/Installers$ chmod +x VMware-Player-6.0.3-1895310.x86_64.bundle


Step 5:

Start the installation

sujin@sujin:~/Installers$ sudo ./VMware-Player-6.0.3-1895310.x86_64.bundle


Step 6:

It will open the GUI to install vmware. skip if it ask license during installation

ENJOY!

Linux Command to Check OS Architecture is 32 or 64 bit

Recent days all the major Linux operating system support two type of  architecture. Those are 32 bit architecture and 64 bit architecture. There is no explicit option available to know which type of architecture you are working. Operating System GUI has option to see this facility even in LINUX knowing everything from Command line has the advantage. Below commands help you to find the Linux operating system architecture. Here i used CentOS release 6.3  to make this article.

1. uname -a  -- This command will display the kernel architecture whether it 32 bit or 64 bit. Output of this command vary depends on the hardware architecture.
    For Intel 32 bit - i686 or x86
    For Intel 64 bit - x86-64

[fedo@localhost ~]$ uname -m 
x86_64


2. getconf LONG_BIT -- We can use this command also to get the architecture

[fedo@localhost ~]$ getconf LONG_BIT 
64


3. arch -- This command also help to find the architecture

[fedo@localhost workspace]$ arch 
x86_64


4. lscpu -- you can get the all the details about OS and CPU support using this command

[fedo@localhost ~]$ lscpu 
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
CPU socket(s):         1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 58
Stepping:              9
CPU MHz:               3192.839
BogoMIPS:              6385.67
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0


5. If you want to get OS architecture through C/C++ program you can use below code

Program:

#include <stdio.h>
int main()
{
    printf("%d bit \n", __WORDSIZE);
    return 0;
}

Output:

64 bit

Check disk space in linux using df command


Linux Version & distribution used for this article
[root@localhost workspace]# uname -sr
Linux 2.6.32-279.el6.x86_64

[root@localhost workspace]# cat /etc/redhat-release
CentOS release 6.3 (Final)



1. df  -- It display available file system details like device name, total size, used space and available space

[root@localhost workspace]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_fedo-lv_root
                      18133780   3579124  14370472  20% /
tmpfs                   247288       420    246868   1% /dev/shm
/dev/sda1               495844     33920    436324   8% /boot


2. a  -- include dummy filesystem

[root@localhost workspace]# df -a
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_fedo-lv_root
                      18133780   3591168  14358428  21% /
proc                         0         0         0   -  /proc
sysfs                        0         0         0   -  /sys
devpts                       0         0         0   -  /dev/pts
tmpfs                   247288       420    246868   1% /dev/shm
/dev/sda1               495844     33920    436324   8% /boot
none                         0         0         0   -  /proc/sys/fs/binfmt_misc
vmware-vmblock               0         0         0   -  /var/run/vmblock-fuse
sunrpc                       0         0         0   -  /var/lib/nfs/rpc_pipefs


3. h  -- human readable format. It will display size format as GB, MB, KB

[root@localhost workspace]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_fedo-lv_root
                       18G  3.5G   14G  21% /
tmpfs                 242M  420K  242M   1% /dev/shm
/dev/sda1             485M   34M  427M   8% /boot


4. df -h /  -- Display only certain mount point

[root@localhost workspace]# df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_fedo-lv_root
                       18G  3.7G   14G  22% /

[root@localhost workspace]# df -h /boot
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             485M   34M  427M   8% /boot


5. df -B 512  -- we can change the size of block its displaying. Below example each block has 512 bytes

[root@localhost workspace]# df -B 512
Filesystem         512B-blocks      Used Available Use% Mounted on
/dev/mapper/vg_fedo-lv_root
                      36267560   7636832  28262360  22% /
tmpfs                   494576       864    493712   1% /dev/shm
/dev/sda1               991688     67840    872648   8% /boot


6. df --block-size=512k  -- display block in KB format. here it will show each block is 512kb

[root@localhost workspace]# df --block-size=512k
Filesystem         512K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_fedo-lv_root
                         35418      7458     27600  22% /
tmpfs                      483         1       483   1% /dev/shm
/dev/sda1                  969        67       853   8% /boot


7. m  -- display block size in MB

[root@localhost workspace]# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/mapper/vg_fedo-lv_root
                         17709      3729     13800  22% /
tmpfs                      242         1       242   1% /dev/shm
/dev/sda1                  485        34       427   8% /boot


8. --total -- display the grand total

[root@localhost workspace]# df --total
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_fedo-lv_root
                      18133780   3818416  14131180  22% /
tmpfs                   247288       432    246856   1% /dev/shm
/dev/sda1               495844     33920    436324   8% /boot
total                 18876912   3852768  14814360  21%


9. i  --  list inode information instead of block usage

[root@localhost workspace]# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/mapper/vg_fedo-lv_root
                     1155072  138135 1016937   12% /
tmpfs                  61822       7   61815    1% /dev/shm
/dev/sda1             128016      40  127976    1% /boot


10. T  -- It will display additionaly filesystem type like ext3, ext4.

[root@localhost workspace]# df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_fedo-lv_root
              ext4    18133780   3818420  14131176  22% /
tmpfs        tmpfs      247288       432    246856   1% /dev/shm
/dev/sda1     ext4      495844     33920    436324   8% /boot


11. t  --  helps to display specific type of file system

[root@localhost workspace]# df -Tt ext4
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_fedo-lv_root
              ext4    18133780   3818412  14131184  22% /
/dev/sda1     ext4      495844     33920    436324   8% /boot


12. x  -- exclude specific type of file system

[root@localhost workspace]# df -Tx ext4
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
tmpfs        tmpfs      247288       432    246856   1% /dev/shm


13. df --help  -- to get df command help information


ENJOY & HAVE FUN WITH LINUX!!!!