Skip to main content

Top Linux Basic Command

1.  To grep the pattern using awk command:

               awk '{print $1,$2,$3,$4,$5,$6,$7}' <file_name> | sort | uniq -c | sort -nr | grep <pattern>

2. To grep the pattern from zipped(*.gz) file using awk command:

                  awk '{print $1,$2,$3 }' <(gzip -dc <zipped_file_name>) | sort uniq -c | sort -nr | grep <pattern>

3. Copy the file from one server to another:
            scp -r root@10.200.134.243:/<source-path> root@10.200.134.195:/<destination-path>

4. To monitor the log:
                tail –f  /var/log/atg/server.log
              
5. To find string the directory:
                grep -nr "string"  <my_directory>

6. To find directory from the sub directory:
            find -type d -name ‘my_directory’

7. To find the file from the sub directory:
            find -type f -name ‘my_file’

8. To find the site response time :
             curl -s -w %{time_total}\\n -o /dev/null <URL>

9. upload file using cURL command
        curl –u ftpusername:ftppassword –T “{file1.txt, file2.txt,file3.txt…}” <url where to upload>

10. To unzip  the zipped file to the specific path :
               unzip *.zip -d /destination path

11. To replace the string to another string in a file in vi mode: 
       Follow the following steps:
                a) vi <file name>
               b) esc + :%s/<old_string>/<new_string>/+ press enter
               c) esc + wq+ enter ==> to save

12: Read the data one by one row wise from csv file:
           while read p;
              do
                   if [ ! -z "$p" -a "$p" != " " ]; then
                       IP=`echo $p | cut -d',' -f1`
                       PORT=`echo $p | cut -d',' -f2`
                      
                       echo "ip= $IP, Port= $PORT"

                   fi
              done < IP_PORT.csv

13.  Remove the pattern for the given specific condition :
           if two pattern should not be in same row, delete it. like pattern1 and pattern2 or pattern2 and pattern3 should not be together etc.

                sed -i "/<pattern1> <pattern2>\|<patten2><pattern3>/d" <file_name>


14. If line contains the specific pattern, delete the line from file using sed command: 

              sed -i '/172.*/!d' netstat_20161230.log
    
15. To replace the file path with another file path using sed command:

            sed -i 's#/srvrs/ag/asapprd1/#/u01/ag/asapprd1/ASAP/#g' /<file_name>

16. To replace the pattern with another pattern in a file using sed command:
             
              sed -i "s/<pattern1>/<pattern2>/g" <file_name>




Comments

Popular posts from this blog

ATG Installation guide step by step

Please find the below environment setup details required for the ATG installation. Step: 1 1. OS: Windows (64-bit) 2. RAM: 8GB minimum  3. JDK 1.8 4. JBoss-eap-6.4 5.   Eclipse mars or neon 6.  Database: Oracle XE 11g Express Edition  7.   Oracle SQL Developer 4.0.3.16  Now its time to follow step 2. (To get all the below software login https://edelivery.oracle.com and download from there) Step 2:   Oracle ATG Web Commerce:  1.  Oracle Commerce ACC (11.2.0.0.0) 2.  Oracle Commerce Platform (11.2.0.0.0) 3.  Oracle Commerce Reference Store (11.2.0.0.0) 4.  Oracle Commerce Store Accelerator (11.2.0.0.0) Oracle Endeca Developer 1.  Oracle Commerce Experience Manager Tools and Frameworks (11.2.0.0.0) 2.  Oracle Commerce Content Acquisition System (11.2.0.0.0) 3.  Oracle Commerce Developer Studio (11.2.0.0.0) 4.  Oracle Commerce Guided Search Platform Services (11.2.0.0.0) 5.  O...

Project is Stuck and not deploying in BCC

If you see below error during project deployment please follow below steps. 1.          Go to the mgmt. schema and run the below query. select * from avm_asset_lock; 2.          If you will find any row, clear that then try to resume the deployment.

ATG Installation guide step by step in Linux environment (CentOS)

Please find the below environment setup details required for the ATG installation. Step: 1 1.  OS: CentOS or any Linux (64-bit) 2.  RAM: 8GB minimum  3.  JDK 1.8 4.  JBoss-eap-6.4 5.   Eclipse mars or neon 6.  Database: Oracle XE 11g Express Edition  7.   Oracle SQL Developer 4.0.3.16  Now its time to follow step 2. (To get all the below software login  https://edelivery.oracle.com  and download from there) Step 2:   Oracle ATG Web Commerce:  1.  Oracle Commerce ACC (11.2.0.0.0) 2.  Oracle Commerce Platform (11.2.0.0.0) 3.  Oracle Commerce Reference Store (11.2.0.0.0) 4.  Oracle Commerce Store Accelerator (11.2.0.0.0) Oracle Endeca Developer 1.  Oracle Commerce Experience Manager Tools and Frameworks (11.2.0.0.0) 2.  Oracle Commerce Content Acquisition System (11.2.0.0.0) 3.  Oracle Commerce Developer Studio (11.2.0.0.0) 4.  Or...