SlideShare a Scribd company logo
1 of 11
Daniel Carneiro Shell Script Parte VI
Exemplos simples ,[object Object],ls  |  wc  -l find  |  wc  -l find  -type f |  wc  -l ,[object Object],fortune  |  tee   temp  ;  wc  temp;  rm  -f temp temp =$( fortune ); echo  $temp ; echo  $temp  |  wc ,[object Object],PS1 ="[ @: ( git   branch  2> /dev/null |  grep -e  ' ' |  sed  's/^...*/{}/') ]  "
Para remover muitos arquivos (500000+): rm   f* bash: /bin/rm: Lista de argumentos muito longa for   i   in   f*;   do   rm   $i; done find   -name  'f*'  -exec   rm  {}  for  i  in  $( find -name  'f*');  do rm  $i;  done
Buscar um aplicativo e matá-lo ps aux  (listar processos) USER  PID %CPU %MEM  VSZ  RSS TTY  STAT START  TIME COMMAND root  1  0.0  0.0  2792  1648 ?  Ss  19:27  0:00 /sbin/init root  2  0.0  0.0  0  0 ?  S  19:27  0:00 [kthreadd] root  3  0.0  0.0  0  0 ?  S  19:27  0:01 [migration/0] root  4  0.0  0.0  0  0 ?  S  19:27  0:00 [ksoftirqd/0] root  5  0.0  0.0  0  0 ?  S  19:27  0:00 [watchdog/0] root  6  0.0  0.0  0  0 ?  S  19:27  0:01 [migration/1] root  7  0.0  0.0  0  0 ?  S  19:27  0:00 [ksoftirqd/1] root  8  0.0  0.0  0  0 ?  S  19:27  0:00 [watchdog/1] root  9  0.0  0.0  0  0 ?  S  19:27  0:00 [events/0] root  10  0.0  0.0  0  0 ?  S  19:27  0:00 [events/1] . . . daniel  2762 35.4  2.4  73372 70772 pts/0  Ss  22:12  22:09 bash daniel  12969  0.0  0.0  2716  1040 pts/1  R+  23:14  0:00 ps aux
Buscar um aplicativo e matá-lo pids= $(  ps  aux|  grep  pts/1|  grep   -v  grep|  tr   -s  " "|  cut   -d  " "  -f  2 ) for  i  in  $pids;  do  kill $i;  done
Install Script #!/bin/bash SID= ${1:-$ORACLE_SID} echo Creating instance  $SID read  -r -p   "Are you sure? [y/N] "  response response= ${response,,}   # tolower if  [[  $response  =~ ^(yes|y)$ ]];  then echo creating... $SID else exit fi
Install Script mkdir  $SID cp  pass.sql  $SID cat  init.ora| sed -e   "s/ORACLE_SID/ $SID /g"  >  $SID /init.ora cat  CreateDB.sql| sed -e   "s/ORACLE_SID/ $SID /g"  >  $SID /CreateDB.sql cat  CreateDBFiles.sql| sed -e   "s/ORACLE_SID/ $SID /g"  >  $SID /CreateDBFiles.sql cat  CreateDBCatalog.sql| sed -e   "s/ORACLE_SID/ $SID /g"  >  $SID /CreateDBCatalog.sql cat  postDBCreation.sql| sed -e   "s/ORACLE_SID/ $SID /g"  >  $SID /postDBCreation.sql
Start/Stop Script
Start/Stop Script
Start/Stop Script
Obrigado

More Related Content

What's hot

ZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 VersionZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 VersionIan Barber
 
How to stand on the shoulders of giants
How to stand on the shoulders of giantsHow to stand on the shoulders of giants
How to stand on the shoulders of giantsIan Barber
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2goMoriyoshi Koizumi
 
Combine vs RxSwift
Combine vs RxSwiftCombine vs RxSwift
Combine vs RxSwiftshark-sea
 
PHPerのためのPerl入門@ Kansai.pm#12
PHPerのためのPerl入門@ Kansai.pm#12PHPerのためのPerl入門@ Kansai.pm#12
PHPerのためのPerl入門@ Kansai.pm#12Kazuki KOMORI
 
NUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialGagah Arifianto
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The AnswerIan Barber
 
Hashing endereçamento aberto - main
Hashing endereçamento aberto - mainHashing endereçamento aberto - main
Hashing endereçamento aberto - mainElaine Cecília Gatto
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleIan Barber
 
01 คำสั่งแสดงผล ในภาษาซี
01 คำสั่งแสดงผล ในภาษาซี01 คำสั่งแสดงผล ในภาษาซี
01 คำสั่งแสดงผล ในภาษาซีPanatchakorn Chaiyanon
 
What is suid, sgid and sticky bit
What is suid, sgid and sticky bit  What is suid, sgid and sticky bit
What is suid, sgid and sticky bit Meenu Chopra
 

What's hot (20)

Git Sensitive Data
Git Sensitive DataGit Sensitive Data
Git Sensitive Data
 
TDDBC お題
TDDBC お題TDDBC お題
TDDBC お題
 
ZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 VersionZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 Version
 
How to stand on the shoulders of giants
How to stand on the shoulders of giantsHow to stand on the shoulders of giants
How to stand on the shoulders of giants
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
Windows shutdown virus source code c++
Windows shutdown virus source code c++Windows shutdown virus source code c++
Windows shutdown virus source code c++
 
Tgh.pl
Tgh.plTgh.pl
Tgh.pl
 
Combine vs RxSwift
Combine vs RxSwiftCombine vs RxSwift
Combine vs RxSwift
 
Linux Command Line
Linux Command LineLinux Command Line
Linux Command Line
 
PHPerのためのPerl入門@ Kansai.pm#12
PHPerのためのPerl入門@ Kansai.pm#12PHPerのためのPerl入門@ Kansai.pm#12
PHPerのためのPerl入門@ Kansai.pm#12
 
NUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline Tutorial
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The Answer
 
Hashing endereçamento aberto - main
Hashing endereçamento aberto - mainHashing endereçamento aberto - main
Hashing endereçamento aberto - main
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made Simple
 
Hands on Hadoop
Hands on HadoopHands on Hadoop
Hands on Hadoop
 
01 คำสั่งแสดงผล ในภาษาซี
01 คำสั่งแสดงผล ในภาษาซี01 คำสั่งแสดงผล ในภาษาซี
01 คำสั่งแสดงผล ในภาษาซี
 
Crack.ba
Crack.baCrack.ba
Crack.ba
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Linear queue
Linear queueLinear queue
Linear queue
 
What is suid, sgid and sticky bit
What is suid, sgid and sticky bit  What is suid, sgid and sticky bit
What is suid, sgid and sticky bit
 

Similar to Shell Scripting

A CTF Hackers Toolbox
A CTF Hackers ToolboxA CTF Hackers Toolbox
A CTF Hackers ToolboxStefan
 
Naughty And Nice Bash Features
Naughty And Nice Bash FeaturesNaughty And Nice Bash Features
Naughty And Nice Bash FeaturesNati Cohen
 
Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識維泰 蔡
 
Os Fetterupdated
Os FetterupdatedOs Fetterupdated
Os Fetterupdatedoscon2007
 
Marko Gargenta_Remixing android
Marko Gargenta_Remixing androidMarko Gargenta_Remixing android
Marko Gargenta_Remixing androidDroidcon Berlin
 
Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly LanguageMotaz Saad
 
Keynote 1 - Engineering Software Analytics Studies
Keynote 1 - Engineering Software Analytics StudiesKeynote 1 - Engineering Software Analytics Studies
Keynote 1 - Engineering Software Analytics StudiesESEM 2014
 
Cleanliness is Next to Domain-Specificity
Cleanliness is Next to Domain-SpecificityCleanliness is Next to Domain-Specificity
Cleanliness is Next to Domain-SpecificityBen Scofield
 
Cleanliness is Next to Domain-Specificity
Cleanliness is Next to Domain-SpecificityCleanliness is Next to Domain-Specificity
Cleanliness is Next to Domain-SpecificityViget Labs
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsHeroku
 
R57php 1231677414471772-2
R57php 1231677414471772-2R57php 1231677414471772-2
R57php 1231677414471772-2ady36
 
What is systemd? Why use it? how does it work? - devoxx france 2017
What is systemd? Why use it? how does it work? - devoxx france 2017What is systemd? Why use it? how does it work? - devoxx france 2017
What is systemd? Why use it? how does it work? - devoxx france 2017Quentin Adam
 
Performance Wins with BPF: Getting Started
Performance Wins with BPF: Getting StartedPerformance Wins with BPF: Getting Started
Performance Wins with BPF: Getting StartedBrendan Gregg
 
start_printf: dev/ic/com.c comstart()
start_printf: dev/ic/com.c comstart()start_printf: dev/ic/com.c comstart()
start_printf: dev/ic/com.c comstart()Kiwamu Okabe
 
PHP in 2018 - Q4 - AFUP Limoges
PHP in 2018 - Q4 - AFUP LimogesPHP in 2018 - Q4 - AFUP Limoges
PHP in 2018 - Q4 - AFUP Limoges✅ William Pinaud
 
Dtrace и немного магии
Dtrace и немного магииDtrace и немного магии
Dtrace и немного магииDan Kruchinin
 
Capital onehadoopclass
Capital onehadoopclassCapital onehadoopclass
Capital onehadoopclassDoug Chang
 

Similar to Shell Scripting (20)

Unix 5 en
Unix 5 enUnix 5 en
Unix 5 en
 
A CTF Hackers Toolbox
A CTF Hackers ToolboxA CTF Hackers Toolbox
A CTF Hackers Toolbox
 
Naughty And Nice Bash Features
Naughty And Nice Bash FeaturesNaughty And Nice Bash Features
Naughty And Nice Bash Features
 
Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識
 
Os Fetterupdated
Os FetterupdatedOs Fetterupdated
Os Fetterupdated
 
Marko Gargenta_Remixing android
Marko Gargenta_Remixing androidMarko Gargenta_Remixing android
Marko Gargenta_Remixing android
 
Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly Language
 
Keynote 1 - Engineering Software Analytics Studies
Keynote 1 - Engineering Software Analytics StudiesKeynote 1 - Engineering Software Analytics Studies
Keynote 1 - Engineering Software Analytics Studies
 
Cleanliness is Next to Domain-Specificity
Cleanliness is Next to Domain-SpecificityCleanliness is Next to Domain-Specificity
Cleanliness is Next to Domain-Specificity
 
Cleanliness is Next to Domain-Specificity
Cleanliness is Next to Domain-SpecificityCleanliness is Next to Domain-Specificity
Cleanliness is Next to Domain-Specificity
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku Secrets
 
R57php 1231677414471772-2
R57php 1231677414471772-2R57php 1231677414471772-2
R57php 1231677414471772-2
 
What is systemd? Why use it? how does it work? - devoxx france 2017
What is systemd? Why use it? how does it work? - devoxx france 2017What is systemd? Why use it? how does it work? - devoxx france 2017
What is systemd? Why use it? how does it work? - devoxx france 2017
 
Performance Wins with BPF: Getting Started
Performance Wins with BPF: Getting StartedPerformance Wins with BPF: Getting Started
Performance Wins with BPF: Getting Started
 
start_printf: dev/ic/com.c comstart()
start_printf: dev/ic/com.c comstart()start_printf: dev/ic/com.c comstart()
start_printf: dev/ic/com.c comstart()
 
PHP in 2018 - Q4 - AFUP Limoges
PHP in 2018 - Q4 - AFUP LimogesPHP in 2018 - Q4 - AFUP Limoges
PHP in 2018 - Q4 - AFUP Limoges
 
Perl basics for Pentesters
Perl basics for PentestersPerl basics for Pentesters
Perl basics for Pentesters
 
Dtrace и немного магии
Dtrace и немного магииDtrace и немного магии
Dtrace и немного магии
 
Bash tricks
Bash tricksBash tricks
Bash tricks
 
Capital onehadoopclass
Capital onehadoopclassCapital onehadoopclass
Capital onehadoopclass
 

More from dcarneir

Introdução ao desenvolvimento em hardware
Introdução ao desenvolvimento em hardwareIntrodução ao desenvolvimento em hardware
Introdução ao desenvolvimento em hardwaredcarneir
 
Certificados digitais
Certificados digitaisCertificados digitais
Certificados digitaisdcarneir
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scriptingdcarneir
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scriptingdcarneir
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scriptingdcarneir
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scriptingdcarneir
 
Bancos de dados No-SQL e afins
Bancos de dados No-SQL e afinsBancos de dados No-SQL e afins
Bancos de dados No-SQL e afinsdcarneir
 

More from dcarneir (13)

Introdução ao desenvolvimento em hardware
Introdução ao desenvolvimento em hardwareIntrodução ao desenvolvimento em hardware
Introdução ao desenvolvimento em hardware
 
Redshift
RedshiftRedshift
Redshift
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Certificados digitais
Certificados digitaisCertificados digitais
Certificados digitais
 
Awk
AwkAwk
Awk
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
FLOSS
FLOSSFLOSS
FLOSS
 
IPv6
IPv6IPv6
IPv6
 
Regex
RegexRegex
Regex
 
Bancos de dados No-SQL e afins
Bancos de dados No-SQL e afinsBancos de dados No-SQL e afins
Bancos de dados No-SQL e afins
 

Recently uploaded

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 

Recently uploaded (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Shell Scripting

  • 1. Daniel Carneiro Shell Script Parte VI
  • 2.
  • 3. Para remover muitos arquivos (500000+): rm f* bash: /bin/rm: Lista de argumentos muito longa for i in f*; do rm $i; done find -name 'f*' -exec rm {} for i in $( find -name 'f*'); do rm $i; done
  • 4. Buscar um aplicativo e matá-lo ps aux (listar processos) USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 2792 1648 ? Ss 19:27 0:00 /sbin/init root 2 0.0 0.0 0 0 ? S 19:27 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? S 19:27 0:01 [migration/0] root 4 0.0 0.0 0 0 ? S 19:27 0:00 [ksoftirqd/0] root 5 0.0 0.0 0 0 ? S 19:27 0:00 [watchdog/0] root 6 0.0 0.0 0 0 ? S 19:27 0:01 [migration/1] root 7 0.0 0.0 0 0 ? S 19:27 0:00 [ksoftirqd/1] root 8 0.0 0.0 0 0 ? S 19:27 0:00 [watchdog/1] root 9 0.0 0.0 0 0 ? S 19:27 0:00 [events/0] root 10 0.0 0.0 0 0 ? S 19:27 0:00 [events/1] . . . daniel 2762 35.4 2.4 73372 70772 pts/0 Ss 22:12 22:09 bash daniel 12969 0.0 0.0 2716 1040 pts/1 R+ 23:14 0:00 ps aux
  • 5. Buscar um aplicativo e matá-lo pids= $( ps aux| grep pts/1| grep -v grep| tr -s " "| cut -d " " -f 2 ) for i in $pids; do kill $i; done
  • 6. Install Script #!/bin/bash SID= ${1:-$ORACLE_SID} echo Creating instance $SID read -r -p "Are you sure? [y/N] " response response= ${response,,} # tolower if [[ $response =~ ^(yes|y)$ ]]; then echo creating... $SID else exit fi
  • 7. Install Script mkdir $SID cp pass.sql $SID cat init.ora| sed -e "s/ORACLE_SID/ $SID /g" > $SID /init.ora cat CreateDB.sql| sed -e "s/ORACLE_SID/ $SID /g" > $SID /CreateDB.sql cat CreateDBFiles.sql| sed -e "s/ORACLE_SID/ $SID /g" > $SID /CreateDBFiles.sql cat CreateDBCatalog.sql| sed -e "s/ORACLE_SID/ $SID /g" > $SID /CreateDBCatalog.sql cat postDBCreation.sql| sed -e "s/ORACLE_SID/ $SID /g" > $SID /postDBCreation.sql

Editor's Notes

  1. tempo de execução: 16s versus 91m find procura subdirs
  2. Diferença entre ' e “