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!!!!





Vector and Iterator in C++



PROGRAM:

#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char *argv[])
{
        vector<int> myarr;

        cout << "\nSize : " << myarr.size() << endl;

        //put data at vector
        myarr.push_back(5);
        myarr.push_back(10);
        myarr.push_back(15);
        myarr.push_back(20);
        myarr.push_back(25);

        cout << "\nSize : " << myarr.size() << endl;
        for (int i = 0; i < myarr.size(); i++)
                cout << "\tArray values " << myarr[i] << endl;

        //delete first value
        myarr.erase(myarr.begin());

        cout << "\nSize : " << myarr.size() << endl;
        for (int i = 0; i < myarr.size(); i++)
                cout << "\tArray values " << myarr[i] << endl;

        //delete last value
        myarr.erase(myarr.end()-1);

        cout << "\nSize : " << myarr.size() << endl;
        for (int i = 0; i < myarr.size(); i++)
                cout << "\tArray values " << myarr[i] << endl;

        //insert at position
        myarr.insert(myarr.begin()+2, 100);

        cout << "\nSize : " << myarr.size() << endl;
        for (int i = 0; i < myarr.size(); i++)
                cout << "\tArray values " << myarr[i] << endl;

        //delete middle value
        myarr.erase(myarr.begin()+1);

        cout << "\nSize : " << myarr.size() << endl;
        for (int i = 0; i < myarr.size(); i++)
                cout << "\tArray values " << myarr[i] << endl;

        return 0;
}


OUTPUT:

Size : 0

Size : 5
        Array values 5
        Array values 10
        Array values 15
        Array values 20
        Array values 25

Size : 4
        Array values 10
        Array values 15
        Array values 20
        Array values 25

Size : 3
        Array values 10
        Array values 15
        Array values 20

Size : 4
        Array values 10
        Array values 15
        Array values 100
        Array values 20

Size : 3
        Array values 10
        Array values 100
        Array values 20


Introduction to GNU profiler

Introduction:

Profiling is the process of finding the time complexity of program.

Profiler will find the time taken by the parts of the code. It will help to programmer
to reconstruct the code if the parts of the code consumed more time.

There is many profiling tools available. But this article give idea on native GNU profiler(gprof)

Step 1:

Write a simple program called proftest.c

#include <stdio.h>
void firstFunction(int );
void secondFunction(int );

int main(int argc, char *argv[])
{
        int a = 10;
        int *b = &a;
        firstFunction(a);
        return 0;
}

void firstFunction(int a)
{
        a += 10;
        sleep(1);
        secondFunction(a);
        return;
}

void secondFunction(int b)
{
        sleep(5);
        printf("final value : %d\n", b);
        return;
}

step 2:
Compile the program with '-pg' option using gcc

gcc -pg proftest.c -o profout

Step 3:
Execute the program

./profout

It will create the gmon.out file in current directory

step 4:
run the gprof with gmon.out

 gprof -b profout gmon.out

You will get the output as below

Flat profile:

Each sample counts as 0.01 seconds.
 no time accumulated

  %   cumulative   self              self     total
 time   seconds   seconds    calls  Ts/call  Ts/call  name
  0.00      0.00     0.00        1     0.00     0.00  firstFunction
  0.00      0.00     0.00        1     0.00     0.00  secondFunction

                        Call graph


granularity: each sample hit covers 2 byte(s) no time propagated

index % time    self  children    called     name
                0.00    0.00       1/1           main [7]
[1]      0.0    0.00    0.00       1         firstFunction [1]
                0.00    0.00       1/1           secondFunction [2]
-----------------------------------------------
                0.00    0.00       1/1           firstFunction [1]
[2]      0.0    0.00    0.00       1         secondFunction [2]
-----------------------------------------------

Index by function name

   [1] firstFunction           [2] secondFunction