0% found this document useful (0 votes)
88 views5 pages

Linux Commands

1. The document provides a collection of Linux commands for finding, searching, copying, moving, deleting, and listing files. 2. It describes the syntax for replacing every occurrence of a string in an entire text file using the ":" command in Linux. 3. Various commands are provided for stopping and starting processes, services, and applications on remote servers.

Uploaded by

Sivakumar
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
0% found this document useful (0 votes)
88 views5 pages

Linux Commands

1. The document provides a collection of Linux commands for finding, searching, copying, moving, deleting, and listing files. 2. It describes the syntax for replacing every occurrence of a string in an entire text file using the ":" command in Linux. 3. Various commands are provided for stopping and starting processes, services, and applications on remote servers.

Uploaded by

Sivakumar
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 5

1. find . -type f -exec grep -Hi 'elabspacewalk.sgdcelab.sabre.

com' {} \;

find . -type f -exec grep -Hi 'emergo' {} \;


ip-10-181-128-126

gzip -cd * | grep -Hi '7959477078793'


2. The syntax for replacing every occurrence of a string in the entire text is
similar. The only difference is the addition of a "%" in front of the "s":

:%s/pattern/replace/
Thus repeating the previous example for the entire text instead of just for a
single line would be:
:%s/lemon/orange/

3. ls -ltR|grep 'Jul 5'

4.
find . -name *.txt Or find / -name .ssh* -print Or find . -name
hp_mcad* -print
find . -print -exec grep -i pen {} \; | more
find . -grep .tar {} \;
find . -exec grep pld {} \;
find . -exec grep -i "vds admin" {} \;
find /prod/users -type f -size 0 -exec ls {} \;
find . -type f -size +10000 -exec ls -al {} \;
find /data -type d -name ".local_sd_customize"
find . -atime +6 -exec ll | more \;
find . -xdev -name "wagoneer*“ –print
find . -atime +30 -exec ls \;
find . -atime +30 -exec ls \; | wc –lf

5. find . -type f -mtime -360 -exec ls -l {} \; > last5days.txt

6. To list Soft Links with absolute path. - find . -type l -exec ls -l {} \;

emg-asx-ar-app0001.cert.sabre.com

7. for i in $(cat sys_servers.lst); do ssh $i 'echo "this is host name


`hostname`";cd /apps/ix/sysop/config; ln -s /apps/ix/config/jms-
parameters.properties jms-parameters.properties; ls -ltr';done

8. for i in $(cat sys_servers.lst); do `scp jms-parameters.properties


cmasx@$i:/apps/ix/config/`;done

9.lsof | egrep '^COMMAND|/tmp.*deleted'

10. find . size 10M -mtime 14 -name *.log.* -exec du -sh {}\;

11. pgrep java | xargs kill -9 -- To kill the process.

12. find . -maxdepth 1 -type f -exec cp -pr {} /apps/ix/webapps_to_Copy/ \;

13.find . -maxdepth 1 -type f -name '*.txt' -mtime +10 -exec mv {}


/apps/ix/tomcat/logs/logs_to_delete/ \;

14. find . -mtime 1 -name *.*


15. for i in $(cat /apps/ix/orchestrator/environments/automate/sys_servers.lst); do
ssh $i 'echo "this is host name `hostname`";cd /apps/ix/sysop/config; rm -ri
systemdescriptor.xml; rm -ri ms-parameters.properties; ln -s /apps/ix/config/jms-
parameters.properties jms-parameters.properties; ln -s
/apps/ix/config/systemdescriptor.xml systemdescriptor.xml; ls -ltr';done;

16.

for i in la; do for x in $(getenv sn $i cert); do ssh $x -q


"/apps/asx/local/$i/sysop/bin/sysall.sh stop"; done; done
Tomcat:

Stop: for i in <cust>; do for x in $(getenv app $i cert); do ssh $x -q


"/apps/asx/local/$i/tomcat/tomcat.sh stop"; done; done
Start: for i in <cust>; do for x in $(getenv app $i cert); do ssh $x -q
"/apps/asx/local/$i/tomcat/tomcat.sh start"; done; done

Sysop Server:

Stop: for i in <cust>; do for x in $(getenv ss $i cert); do ssh $x -q


"/apps/asx/local/$i/sysop/bin/sysall.sh stop"; done; done
Start: for i in <cust>; do for x in $(getenv ss $i cert); do ssh $x -q
"/apps/asx/local/$i/sysop/bin/sysall.sh start"; done; done

Sysop Nodes:

Stop: for i in <cust>; do for x in $(getenv sn $i cert); do ssh $x -q


"/apps/asx/local/$i/sysop/bin/sysall.sh stop"; done; done
Start: for i in <cust>; do for x in $(getenv sn $i cert); do ssh $x -q
"/apps/asx/local/$i/sysop/bin/sysall.sh start"; done; done

Action Servers:

Stop: for i in <cust>; do for x in $(getenv as $i cert); do ssh $x -q


"/apps/asx/local/$i/actionserver/tomcat.sh stop"; done; done
Start: for i in <cust>; do for x in $(getenv as $i cert); do ssh $x -q
"/apps/asx/local/$i/actionserver/tomcat.sh start"; done; done

You can put multiple customers too in the same script. Say for eg. If you are
trying to kill action servers of wy and pr. You can run like below.

for i in wy pr; do for x in $(getenv app $i cert); do ssh $x -q


"/apps/asx/local/$i/tomcat/tomcat.sh stop"; done; done

Unfortunately the validation part, we have to do manually. Please find the steps
below.
1. Open PM + for each customer and check if its accessible.
2. Run the below validation commands on DB and you should see latest time stamp.
--Booking Feed checks run in database:
select max(booking_date) from booking;
select max(last_update_in_cads) from booking;

--Ticket (depending on table Tickets or Ticket_Document) Feed checks run in the


database:
select max(DATE_TICKET_ISSUED) from TICKET_DOCUMENT;
select max(last_update_in_cads) from TICKET_DOCUMENT;

--Time events firing verification:


select * from INIT_PARAMETER where PARAMETER_NAME = 'LAST_TIME_EVENT_QUERY';
3. Validate AC and NAC.

Please feel free to ask questions whenever you feel required. Also if you have any
suggestions, let me know that too. 😊

Performance Log:

grep ' - Processing time for TicketDocument'


Performance.TicketDocumentClientAnalysisQueueReader*.log 13>100){print $4 " " $5 "
- " $7 " " $8 " " $9 " " $10 " " $11 " " $12 " " $13 " " $14}}'

AS_CUR_OWNR

update time_event_log set next_eval_date = next_eval_date + 1 where next_eval_date


is not null
and exists (select 1 from queue_member qm where qm.queue_member_id =
queue_member_id);

ps -ef | grep java | cut -c1-500

sed -i 's/info/debug/g' sysop/bin/SysopNode.wrapper.conf

netstat -nap | grep LISTEN | grep java | grep 12011

Delete only files - find . -type f -exec rm -rf '{}' \;

Selecting top 1000 rows based on some condition.

select * from (
select t.*, row_number() over (order by time_of_Action desc) rn
from Action_Log t
)
where rn <= 1000
order by rn;

select * from Action_log where Time_of_Action >= sysdate - 3/24 order by


Time_of_Action desc;

select * from action_log where TIME_OF_ACTION >= sysdate - 2/24 and SUCCESS_FLAG =
0 order by Time_of_Action desc;

select * from Action_log where Time_of_Action >= sysdate - 2/24 order by


Time_of_Action desc;

select * from Action_log where Time_of_Action >= sysdate - 3 and failed_reason is


not null order by Time_of_Action desc;

select * from action_log where TIME_OF_ACTION >= sysdate - 8/24 and SUCCESS_FLAG >
0 order by Time_of_Action desc;
find . -type f -newermt '08/14/2019 9:40:00' -exec ls -al {} \;

find . -type f -name '*.tar.gz*' -mtime +180 -exec mv {}


/apps/ix/batch/ops/processed/to_delete \;

find . -type f -name '*.log' -mtime +15 -exec mv {}


/apps/ix/log/tomcat/logs_to_delete \;

find . -type f -name '*.log' -mtime +15 -exec ls -ltr \;

[asx@ixp-va-sys-03 processes]$ grep 'Total processing time'


Performance.BookingAnalysisQueueReader.ixp-va-sys-02.log | awk '{if ($15>10){print
$4 " " $5 " - " $7 " " $8 " " $9 " " $10 " " $11 " " $12 " " $14 " " $15 " " $16}}'

find . -type f -mtime +5 -print0 | /usr/bin/xargs -r -0 rm -rf

find . -type f -mtime +7 -print0 | /usr/bin/xargs -r -0 ls -ltr

du -sh * | sort -rh

DB Time Zone:
-------------

SELECT TO_CHAR

(SYSDATE, 'MM-DD-YYYY HH24:MI:SS') "NOW"

FROM DUAL;

select dbtimezone from dual;

+00:00

select SYSTIMESTAMP from dual;

Remove Duplicates line - In notepad ++

https://medium.com/@heitorhherzog/compare-sort-and-delete-duplicate-lines-in-
notepad-2d1938ed7009

^(.*?)$\s+?^(?=.*^\1$)

ps -ef|grep -o -P '(?<=asx\.name\=).*?([^\s]+)'|sort

DNS - Check
=============

http://dnsrequest.sabre.com/#Verify
For external use https://www.digwebinterface.com/?

Deployer Server - SCP


====================
scp -r -i ~/.ssh/keys/AVRI-JU-prod-key.pem centos@10.181.129.149:/apps/ix/2.2.0-
GA7.tar .

Remove Duplicate: (Notepad ++)

^(.*?)$\s+?^(?=.*^\1$)

You might also like