Amazon festival offer

Sunday 23 December 2012

Basic Unix commands



Basic UNIX commands :-
• To change the current directory to another directory
                     Syntax-          cd [path_of_directory]
Note: - UNIX is case sensitive so type the same directory name
                                              [localhost@root ~]$ cd /home/user/data
                                              [localhost@root data]$
• To change the current directory to your home directory
                     Syntax-         cd
                                              [localhost@root data]$ cd
                                              [localhost@root ~]$
Note: - The current directory should now be your home directory.
• To create a directory inside the current directory
                     Syntax-           mkdir [name_of_new_directory]
                                               [localhost@root ~]$ mkdir test
              Test directory now should exist within the current directory.
• The cp command is use to make a copy of a file
                     Syntax-           cp [name of file] [name of copy]
                                               [localhost@root ~]$ cp old_directory  new_directory_name
 mv command is used to either rename an existing file or folder to something different
                or to “move” a file from one directory to another.
                     Syntax-           mv [name of existing file] [new name for existing file]
                                              [localhost@root ~]$ mv name_of_existing_file new_name_for_existing_file
• To move an existing file, type
                     Syntax-           mv [name of existing file] [path of new location]
                                               [localhost@root inteljasper]$ mv file_name  path_where_to_copy
                                               [localhost@root ~]$ mv mydir  /home/localhost/test/
• rm command is used to delete a file, to remove an existing file, type
                     Syntax-         rm [name of file]
                                              [localhost@root ~]$ rm  file_name
• rmdir command is a separate command for removing directories. To remove a directory, the directory must be empty. To remove an existing directory, type
                     Syntax-          rmdir [name of directory]
                                                 [localhost@root ~]$ rmdir directory_name
Some basic useful commands and there output: -

• date
                     Syntax-           [localhost@root~]$date
                     Output -         Fri Dec 23 10:30:05 IST 2011
• tput clear - To clear the screen clear is an argument of tput command.
                     Syntax-           [localhost@root~]$ tput clear   
• cal – Calendar of current month
                     Syntax-            [localhost@root~]$ cal     
• cal 1 1987 – to see the calendar of January 1987
                     Syntax-           [localhost@root~]$ cal 1 1987    
• who – to see who are the users? It will show all the users who are currently logged in.
                     Syntax-          [localhost@root~]$ who           
                     Output-          localhost   pts/1        2011-12-23 10:29 (sharad-pc.home)
• ps – to view the running process
                     Syntax-          [localhost@root~]$ps             
                     Output-          PID TTY          TIME CMD
                                                  14493 pts/1    00:00:00 bash
                                                  14691 pts/1    00:00:00 ps
• ksh -
                     Syntax-          [localhost@root~]$ksh             Korn shell it will show only like this
                     Output -        $
                     Syntax-          $ sh                                                   Bourne shell(sh-3.2$)
                     Syntax-          $ csh                                                 C shell
                     Syntax-          $bash                                                Bash  shell(original shell)
                     Output-         [localhost@root~]$
• ls – to list all the files
                     Syntax-         [localhost@root~]$ls            
                           files are arranged alphabetically with uppercase having      precedence over lower case)
 •  ls chap*
                     Syntax-        [localhost@root~]$ls chap*      
                            It will list all files starting with chap word
  ls –l chap*
                     Syntax-       [localhost@root~]$ls -l chap*  
                     Output-       -rw-rw-r-- 1 localhost localhost    286 Dec 19 12:20 list
  ls > list
                     Syntax-        [localhost@root~]$ls > list     
                               Directing output to a file name list. Prompts return no display on the terminal (">" is a                     
                               metacharacters )
  cat list  - to open any file
                     Syntax-         [localhost@root~]$cat list         
                                                       list is a file name where all the list of files are stored you can give any name.
  wc list  -
                     Syntax-          [localhost@root~]$wc list              Counting number of lines in a file
                     Output-           6   6   42 list                  means 6 lines,6words,42 character
•  ls | wc -  Feeding output of one command to another using "|"pipeline
                      Syntax-         [localhost@root~]$ls | wc   or
                                                      [localhost@root~]$ls|wc
• Programing with the shell
                    You can assign a value to a variable at the prompt
                      Syntax-         [localhost@root~]$ x=5             
                     No space on either side of = and then evaluate the value of this variable with the echo command
                      Syntax-         [localhost@root~]$ echo $x
                      Output-        op/  5
• Exit : signing off
                      Syntax-          [localhost@root~]$exit         
                                 Or                    [localhost@root~]$logout
                    Syntax-         [localhost@root~]$echo sharad            gupta
                      Output-          o/p   sharad gupta
  
                      Syntax-          [localhost@root~]$echo $PATH
  
                      Syntax-          [localhost@root~]$type ls
                      Output-           ls is aliased to `ls --color=tty'
  
                      Syntax-         [localhost@root~]$type echo      to know which command it is
                      Output-          echo is a shell builtin
•  Combined commands
                      Syntax-         [localhost@root~]$wc list; ls -l list
                      Output-        18  18 289 list
                                                          -rw-rw-r-- 1 localhost localhost 289 Dec 19 12:26 list

•  Save the results in new file
                      Syntax-         [localhost@root~]$ ( wc test ; ls -l test ) > newlist
•  To know about any command
                      Syntax-         [localhost@root~]$man -k awk
                      Output-         English              (3pm)  - use nice English (or awk) names for ugly  
                                                             punctuation variables
                                                            a2p                  (1)  - Awk to Perl translator
                                                           awk                  (1p)  - pattern scanning and processing language
                                                          gawk                 (1)  - pattern scanning and processing language
                                                           gawk                (rpm) - The GNU version of the awk text processing utility.

Delete the services in windows operating system



Sometimes you may need to delete the service from windows services.
To delete service go to Run prompt and type services.msc

Right click on the service which you want to delete and make it manual if it is automatic.
Start command prompt 


Type  sc delete service_name

If there is space in between service name use “ ” such as if service name is MySQL database
Then type

Reset the root password in Centos 6.3



Sometimes if you forgot the root password of Centos server then you may need to reset the root password.

These are some important steps to reset the root password of the server.

1: Restart the server (to restart the server you may require root password, so start directly from CPU)

2: Press Esc when server start.

3: Select 2nd option 

4: Press e

                      Grub edit>kernel…../…LogVoloo_S (insert S)
 For 6.3 just enter (space ) S or 1

5: Enter

6: b (inorder to boot into single user mode)

7: Check the SELinux mode
                       >getenforce
    If its enforcing type
                       >setenforce 0
Else

8: passwd

9: init 6 (reboot the system)

Monday 16 July 2012

JasperReport Server Customization - Export JaspReport in Excel Format





JasperReport server provide the facility to export reports in various format like PDF, Excel, CSV and Flash and many more but by default excel export option is disabled in JasperReport server, so if you want to enable excel export option 

Go to this location

<js-install-directory> \apache-tomcat\webapps\jasperserver\WEB-INF\ Applicationcontext.xml

and open Applicationcontext.xml file with notepad and search for the "ignoreGraphics" property


<bean id="xlsExportParameters" class="com.jaspersoft.jasperserver.api.engine.jasperreports.common.XlsExportParametersBean">
        <property name="detectCellType" value="true"/>
        <property name="onePagePerSheet" value="false"/>
        <property name="removeEmptySpaceBetweenRows" value="true"/>
        <property name="removeEmptySpaceBetweenColumns" value="true"/>
        <property name="whitePageBackground" value="false"/>
        <property name="ignoreGraphics" value="false"/>
        <property name="collapseRowSpan" value="true"/>
        <property name="ignoreCellBorder" value="true"/>
        <property name="fontSizeFixEnabled" value="true"/>
        <property name="maximumRowsPerSheet" value="0"/>
        <property name="xlsFormatPatternsMap" ref="formatPatternsMap"/>
    </bean>


Change ignoreGraphic property false to true to export charts in excel format

   <property name="ignoreGraphics" value="true"/>