Monday, March 18, 2013


Run Unix Commands on Windows                                    Grub Boot Loader

People always complain that there are not enough softwares available in Linux/Unix which we require for daily life but it is not true. There are enough softwares  available in Unix and all these softwares are open source. We can easily download and install it and suppose, in Linux repository, we couldn’t find the required package then install windows software on Linux that will be the best way. So, we are going to understand how to install wine application which is creating windows like environment on Unix for windows applications.
Wine is the package which used for creating environment of Windows on Linux. It is open source package. Installation and configuration of wine is quite easy. you can download winehq from here.

Features of Wine

·         Wine allows you to run many Windows programs on Linux.
·         If we are using latest version of Wine then we can get assistance from winehq channel on irc.freenode.net.
If you need complete installation of Windows then you can look for Qemu as well. It is also an open source application.

Install Wine on Ubuntu Server

Let’s install wine on Ubuntu server first:
It is very easy to install Wine on Ubuntu Server. Need to follow below steps to install it :

Step 1: Run below command to update repository.

sudo add-apt-repository ppa:ubuntu-wine/ppa

This PPA can be added to your system manually by copying the lines below and adding them to your system's software sources. For each Ubuntu server it will change if you are installing it on Quantal 12.10 Ubuntu then following lines will be added in your system’s software sources:


These lines will be different as per your version of OS.

Step 2: update APT package information by running.

sudo apt-get update

Step 3  : We can now install Wine directly. Run below command.

sudo apt-get install wine1.5

Wine is installed on Ubuntu. Please check for application, it will come in list.

Configuration of Wine in Ubuntu

Before using Wine, we need to configure it. It needs fake c: drive where windows application will be installed. To create fake drive, run following command.

winecfg

We have another method as well to do this by going to Applicationsà Accessories Ã  Terminal
We have configure wine option in the Applications Ã  Wine menu
The above command will create a hidden folder for wine  in home directory of current user. Once directory created then wine configuration window will appear and customize settings as you need.  If you want change the application specific changes then also run above command. Pop will come for menus and then click on Add application and navigate to where exe resides and then select it. Change the settings as per your requirement.

Install windows application in Wine

Now it is time to install windows application in Wine.
Step 1: Download the exe or any kind of installable file of windows for the application.
Step 2: Save at somewhere and cd to that directory through terminal.
Step 3: Type as follow:

                Wine name-of-application.(extension)                                  e.g.  wine vlc.exe

While installation, if application asks for directory to save files then select C: drive. (We already created C: drive). Whenever you want to run this application then go to that directory and above command or go to wine browser and double click on launch icon it will start that application.

Uninstall Wine

If you want to uninstall the wine then run following command it will uninstall it. Run terminal and run command.

wine uninstaller


Posted by Machindra Dharmadhikari On 3/18/2013 12:55:00 AM 3 comments READ FULL POST

Thursday, March 14, 2013

Recover deleted files                                                                  Run Unix command on Windows


Jmap command is specially used to trace memory mapping of process. jmap prints shared object memory maps or heap memory details of a given process or core file or a remote debug server. Man page of the jmap command also useful to get idea about commands use. If the given process is running on  a 64-bit VM, you may need to specify the -J-d64 option, e.g.:

            jmap -J-d64 -heap pid

SYNOPSIS
       jmap [ option ] pid
       jmap [ option ] executable core
       jmap [ option ] [server-id@]remote-hostname-or-IP

PARAMETERS
       option
            Options are mutually exclusive. Option, if used, should follow immediately after the command name.

       pid
            Process  id  for which the memory map is to be printed. The process must be a Java process. To     get a list of Java processes running on a machine, jps may be used.

       executable
          Java executable from which the core dump was produced.

       core
          Core file for which the memory map is to be printed.

       remote-hostname-or-IP
          Remote debug server's (see jsadebugd) hostname or IP address.

       server-id
          Optional unique id, if multiple debug servers are running on the same remote host.


Click here to know more about: Jstat Command in Linux

OPTIONS

            <no option> 
                        When  no  option is used jmap prints shared object mappings. For each shared object                     loaded in the target VM, start address, the size of the mapping, and the full path of the shared     object file are printed. This is similar to the Solaris pmap utility. You can see the output of this command at this link : Check Java Process Performance and statistics in Linux

            -dump:[live,]format=b,file=<filename>
                        Dumps the Java heap in hprof binary format to filename. The live suboption is optional.                 If specified, only the live objects in the heap  are  dumped.  To browse the heap dump, you can        use jhat (Java Heap Analysis Tool) to read the generated file.

            -finalizerinfo
                        Prints information on objects awaiting finalization.

            -heap
                        Prints a heap summary. GC algorithm used, heap configuration and generation wise heap usage are printed.

            -histo[:live]
                        Prints  a  histogram  of the heap. For each Java class, number of objects, memory size in    bytes,   and fully qualified class names are printed. VM internal class names are printed                                    with prefix. If the live suboption is specified, only live objects are counted.

            -permstat
                        Prints class loader wise statistics of permanent generation of Java heap. For each class       loader, its name, liveness, address, parent  class  loader,  and the number and size of classes it            has loaded are printed. In addition, the number and size of interned Strings are printed. Using            this option if you want to see the output then click here: Check Java Process Performance and statistics in Linux

            -F Force
                        Use with jmap -dump or jmap -histo option if the pid does not respond. The live    suboption is not supported in this mode.


Click here to know more about: While Loop in Shell Scripting
Posted by Machindra Dharmadhikari On 3/14/2013 11:19:00 AM No comments READ FULL POST
Install Wine on Ubuntu                                                 Check CPU Usage in Linux
Jstat command is a Java Virtual Machine Statistics Monitoring Tool. The  jstat  tool displays performance statistics for an instrumented HotSpot Java virtual machine (JVM). Man page of jstat command is also useful to get idea about this command. The target JVM is identified by its virtual machine identifier.

SYNOPSIS
       jstat [ generalOption | outputOptionsvmid [interval[s|ms] [count]] ]

PARAMETERS
       generalOption :
                        A single general command-line option (-help, -options, or -version)
           
       outputOptions:
                        One or more output options, consisting of a single statOption, plus any of the -t, -h, and                            -J options.

       vmid
                        Virtual machine identifier, a string indicating the target Java virtual machine (JVM). The               general syntax is
                        [protocol:][//]lvmid[@hostname[:port]/servername]
                        The syntax of the vmid string largely corresponds to the syntax of a URI. The vmid can                            vary from a simple integer representing a local JVM to a more complex construction                                  specifying a communications protocol, port number, and  other  implementation-specific                values.  See  Virtual  Machine  Identifier  for details.

       interval[s|ms]
                      Sampling  interval  in the specified units, seconds (s) or milliseconds (ms). Default unit                                are milliseconds.  Must be a positive integer.  If specified, jstat will produce its output at               each interval.

       count
                      Number of samples to display. Default value is infinity; that is, jstat displays statistics                                 until the target JVM terminates or the jstat command is  terminated. Must be a positive                             integer.

Click here to know more about: Jmap Command in Linux

VIRTUAL MACHINE IDENTIFIER
                               The syntax of the vmid string largely corresponds to the syntax of a URI:
                               [protocol:][//]lvmid[@hostname][:port][/servername]
OPTIONS:
            -statOption
                        Determines  the  statistics information that jstat displays. The following table lists                          the available options.  Use the -options general option to display the list of options                               for a particular platform installation.

            -hn
                        Display a column header every n samples (output rows), where n is a positive integer.                                Default value is 0, which displays  the  column  header  above  the first row of data.
           
            -tn
                        Display a timestamp column as the first column of output. The timestamp is the the time               since the start time of the target JVM.

            -JjavaOption
                        Pass javaOption to the java application launcher. For example, -J-Xms48m sets the                                    startup memory to 48 megabytes.
STAT OPTIONS
             -class Option
            -compiler
            -gc Option ( You will get sample output at :  Check Java Process Performance and statistics in Linux )
            -gccapacity Option
            -gccause
            -gcnew Option
            -gcnewcapacity Option
            -gcold Option
            -gcoldcapacity Option
            -gcpermcapacity Option
            -gcutil
            -printcompilation Option


Using the gcutil option
                   This example attaches to lvmid 21891 and takes 7 samples at 250 millisecond intervals and                displays the output as specified by the -gcutil option.

       jstat -gcutil 21891 250 7

         S0     S1     E      O      P     YGC    YGCT    FGC    FGCT     GCT

        12.44   0.00  27.20   9.49  96.70    78    0.176     5    0.495    0.672

        12.44   0.00  62.16   9.49  96.70    78    0.176     5    0.495    0.672

TimeStamp for each sample

                   This example attaches to lvmid 21891 and takes 3 samples at 250 millisecond intervals. The -t option is used to generate a time stamp for each sample in the
       first column.
       jstat -gcoldcapacity -t 21891 250 3

       Timestamp          OGCMN        OGCMX         OGC           OC       YGC   FGC    FGCT    GCT

                 150.1       1408.0      60544.0      11696.0      11696.0   194    80    2.874   3.799

                 150.4       1408.0      60544.0      13820.0      13820.0   194    81    2.938   3.863

                 150.7       1408.0      60544.0      13820.0      13820.0   194    81    2.938   3.863

                   The Timestamp column reports the elapsed time in seconds since the start of the target                       JVM. In   addition, the -gcoldcapacity output shows the old generation capacity (OGC) and the   old space capacity (OC) increasing as the heap expands to meet allocation and/or promotion             demands. The old generation capacity (OGC) has grown to from 11696 KB to 13820 KB after          the 81st Full GC (FGC). The maximum capacity of the generation (and space) is 60544 KB         (OGCMX), so it still has room to expand.

Options details :

S0C
Current survivor space 0 capacity (KB).
S1C
Current survivor space 1 capacity (KB).
S0U
Survivor space 0 utilization (KB).
S1U
Survivor space 1 utilization (KB).
EC
Current eden space capacity (KB).
EU
Eden space utilization (KB).
OC
Current old space capacity (KB).
OU
Old space utilization (KB).
PC
Current permanent space capacity (KB).
PU
Permanent space utilization (KB).
YGC
Number of young generation GC Events.
YGCT
Young generation garbage collection time.
FGC
Number of full GC events.
FGCT
Full garbage collection time.
GCT
Total garbage collection time.

            Memory Pool Generation and Space Capacities
           

NGCMN
Minimum new generation capacity (KB).
NGCMX
Maximum new generation capacity (KB).
NGC
Current new generation capacity (KB).
S0C
Current survivor space 0 capacity (KB).
S1C
Current survivor space 1 capacity (KB).
EC
Current eden space capacity (KB).
OGCMN
Minimum old generation capacity (KB).
OGCMX
Maximum old generation capacity (KB).
OGC
Current old generation capacity (KB).
OC
Current old space capacity (KB).
PGCMN
Minimum permanent generation capacity (KB).
PGCMX
Maximum Permanent generation capacity (KB).
PGC
Current Permanent generation capacity (KB).
PC
Current Permanent space capacity (KB).
YGC
Number of Young generation GC Events.
FGC
Number of Full GC Events.


                        Garbage Collection Statistics, Including GC Events                    


LGCC
Cause of last Garbage Collection.
GCC
Cause of current Garbage Collection.

If you want to get details about CPU utilization then click on : Check CPU uitlization by mpstat command
Posted by Machindra Dharmadhikari On 3/14/2013 11:11:00 AM No comments READ FULL POST
  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

    Chitika Ads 2

    Histat

    About

    Enter your email address:

    Delivered by FeedBurner