Friday, November 19, 2010

Linux Commands

$cat:  
              Syntax: cat > filename
      • It is use to create a file
      • It is display the contents of a file
      • It is used to merge more than one file into new file. If new file already exists than it will overwritten otherwise it will be created.
      • It is also used to merged more than one file and it will appened at ladt in a new file.
      • It is use to append the data at the end of file.
      • It is used to display the contents of a file with line number.
      • It is used to create hidden files.                      
                    
                   Examples:
      • cat >Maulik
                              It will create new file named Maulik like,
                     
                              cat > Maulik

                              Maulik Dave
                              Div A
                              Roll No 009
                              ^Z

      • cat BPCCS
                              It will show all the content of the file.

      • cat file1 file2 file3 >file4
                              It will merge all the data of file1, file2 and file3 and store in file4.

      • cat file1 file2 file3 >>file4
                              It will append all the data of file1, file2 and file3 in file4.

      • cat -n file1
                              It will show all the data with line number like,
                                           
                                                 1. Maulik Dave
                                                 2. Div A
                                                 3. Roll No 009


      • cat >.Maulik
                              It will make new hidden file.