SlideShare a Scribd company logo
Using The Command Line:
Bash And WP-CLI
NERDY GOODNESS 🙂
https://marcgratch.com | mgratchWordCamp Birmingham 2018
Why Use CLI?
• Repeatable Tasks
• Browsers Time Out
• Great For Mashing Commands Together
• All The Cool Kids Are Doing It
https://marcgratch.com | mgratchWordCamp Birmingham 2018
Getting Started
• Mac: Applications -> Utilities -> Terminal -> Done!
• Windows: Download Bash git-scm.com-> install -> Done!
• Also Windows: Configure Linux Subsytem
https://marcgratch.com | mgratchWordCamp Birmingham 2018
Navigating Commands
pwd Present Working Directory
ls List Directory
cd Change Directory
~ Home Directory
- Last Directory
../ Parent Directory
./ Current Directory
/ System Root
Anatomy of a Command
Syntax:
<command> [Options] [Parameter1…2]
HINT! Press `tab` to
autocomplete paths.
https://marcgratch.com | mgratchWordCamp Birmingham 2018
File/Directory Management Commands
touch Create a file
mkdir Make a Directory
cp Copy files/directories
mv Move files/directories
rm Remove a file
rmdir Remove a Directory
Recursively Removing Directories and Files:
rm -rf ~/trash_folder
BE CAREFUL… THERE IS NO UNDO!
> File Write to file
>> File Append to file
cat Read file
less Convert a string to pages
wc Word Count
https://marcgratch.com | mgratchWordCamp Birmingham 2018
Useful Commands & Pipes
find Find files or folder
grep Search String
tail Get the last lines of a file
xargs Convert output to args
uniq | sort Sort and remove duplicates
Piping Commands:
find -name "*.sql" | uniq | sort | wc –l
Command returns STDOUT | command consumes STDIN returns STDOUT |…so on…
STDIN Output of a function
STDIN Input from a pipe
| Pipe, used to chain functions
https://marcgratch.com | mgratchWordCamp Birmingham 2018
A Little Beyond the Basics
apt-get Install packages
sudo Super User Do
curl/wget GET/POST Requests
pv mySQL progress bar
• git
• npm
• ponysay?
Useful Packages
Installing Packages:
Mac: Use Brew
Linux: apt-get
apt-get Command:
[sudo] apt-get install git
[sudo] apt-get install nodejs
[sudo] npm install json
pv Command:
pv file.sql | mysql -u -p <database>
https://marcgratch.com | mgratchWordCamp Birmingham 2018
WP-CLI | mklife easier
https://marcgratch.com | mgratchWordCamp Birmingham 2018
WP-CLI Requirement
• Bash
• PHP 5.3.29
• SSH (if not local)
Install Instructions
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
Syntax:
wp <command> [subcommand] [Options]
Anatomy of a
WP-CLI Command
All WP-CLI Commands
https://developer.wordpress.org/cli/commands/
https://marcgratch.com | mgratchWordCamp Birmingham 2018
Some Useful Simple WP-CLI Commands
Deactivate all plugins:
wp plugin deactivate --all
Regenerate thumbnails:
wp media regenerate --yes
Update all plugins:
wp plugin update --all
Update all themes:
wp theme update --all #delete unused themes
Update WP Core:
wp core update
Clear the object cache:
wp cache flush
Delete all transients:
wp transient delete --all
https://marcgratch.com | mgratchWordCamp Birmingham 2018
Some Advanced CLI Info
• Bash is a complete language!
• Loops, Arrays, Conditionals
• https://gist.github.com/mgratch
https://marcgratch.com | mgratchWordCamp Birmingham 2018
More topics
Permissions chmod, chown, permission codes.
System Health df, du, top, htop
Task runners & package managers Grunt, Gulp, Webpack, composer, npm
https://marcgratch.com | mgratchWordCamp Birmingham 2018
Great Resources
wptavern.com wp-cli.org tommcfarlin.com
poststatus.com make.wordpress.org pippinsplugins.com
joshpress.net wordpress.tv carriedils.com
tuts+ wpchat.com carlalexander.ca
torquemag.io wpbeginner.com yoast.com
wpshout.com wpmayor.com gravitywiz.com
wplift.com chrislema.com webdevstudios.com
training.leftlogic.com javorszky.co.uk developer.wordpress.org
https://marcgratch.com | mgratchWordCamp Birmingham 2018

More Related Content

What's hot

Varnish Caching
Varnish CachingVarnish Caching
Varnish Caching
Gareth Rushgrove
 
Modern web technologies
Modern web technologiesModern web technologies
Modern web technologies
Simeon Prusiyski
 
Deploying Drupal using Capistrano
Deploying Drupal using CapistranoDeploying Drupal using Capistrano
Deploying Drupal using Capistrano
Jochen Verdeyen
 
Automate All the Things with Grunt
Automate All the Things with GruntAutomate All the Things with Grunt
Automate All the Things with Grunt
Sheelah Brennan
 
How go makes us faster (May 2015)
How go makes us faster (May 2015)How go makes us faster (May 2015)
How go makes us faster (May 2015)
Wilfried Schobeiri
 
Capistrano demo
Capistrano demoCapistrano demo
Capistrano demo
Edward Meehan
 
Extending Foreman the easy way with foreman_hooks
Extending Foreman the easy way with foreman_hooksExtending Foreman the easy way with foreman_hooks
Extending Foreman the easy way with foreman_hooks
Dominic Cleal
 
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small Teams
Joe Ferguson
 
"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada
Fwdays
 
Production Ready Javascript With Grunt
Production Ready Javascript With GruntProduction Ready Javascript With Grunt
Production Ready Javascript With Grunt
XB Software, Ltd.
 
Gulp: Task Runner
Gulp: Task RunnerGulp: Task Runner
Gulp: Task Runner
Christopher Bautista
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session I
Oded Sagir
 
Preprocessor Workflow with Grunt
Preprocessor Workflow with GruntPreprocessor Workflow with Grunt
Preprocessor Workflow with Grunt
Vlad Filippov
 
Beyond Puppet
Beyond PuppetBeyond Puppet
Beyond Puppet
Kris Buytaert
 
Devenez le plus heureux des Front-end avec Gulp.js
Devenez le plus heureux des Front-end avec Gulp.jsDevenez le plus heureux des Front-end avec Gulp.js
Devenez le plus heureux des Front-end avec Gulp.js
Rémy Savard
 
Madison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small TeamsMadison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small Teams
Joe Ferguson
 
Npm scripts
Npm scriptsNpm scripts
Npm scripts
정윤 김
 
Automated Development Workflow with Gulp
Automated Development Workflow with GulpAutomated Development Workflow with Gulp
Automated Development Workflow with Gulp
plewicki
 
Frontend Build Tools - CC FE & UX
Frontend Build Tools - CC FE & UXFrontend Build Tools - CC FE & UX
Frontend Build Tools - CC FE & UX
JWORKS powered by Ordina
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngine
NGINX, Inc.
 

What's hot (20)

Varnish Caching
Varnish CachingVarnish Caching
Varnish Caching
 
Modern web technologies
Modern web technologiesModern web technologies
Modern web technologies
 
Deploying Drupal using Capistrano
Deploying Drupal using CapistranoDeploying Drupal using Capistrano
Deploying Drupal using Capistrano
 
Automate All the Things with Grunt
Automate All the Things with GruntAutomate All the Things with Grunt
Automate All the Things with Grunt
 
How go makes us faster (May 2015)
How go makes us faster (May 2015)How go makes us faster (May 2015)
How go makes us faster (May 2015)
 
Capistrano demo
Capistrano demoCapistrano demo
Capistrano demo
 
Extending Foreman the easy way with foreman_hooks
Extending Foreman the easy way with foreman_hooksExtending Foreman the easy way with foreman_hooks
Extending Foreman the easy way with foreman_hooks
 
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small Teams
 
"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada
 
Production Ready Javascript With Grunt
Production Ready Javascript With GruntProduction Ready Javascript With Grunt
Production Ready Javascript With Grunt
 
Gulp: Task Runner
Gulp: Task RunnerGulp: Task Runner
Gulp: Task Runner
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session I
 
Preprocessor Workflow with Grunt
Preprocessor Workflow with GruntPreprocessor Workflow with Grunt
Preprocessor Workflow with Grunt
 
Beyond Puppet
Beyond PuppetBeyond Puppet
Beyond Puppet
 
Devenez le plus heureux des Front-end avec Gulp.js
Devenez le plus heureux des Front-end avec Gulp.jsDevenez le plus heureux des Front-end avec Gulp.js
Devenez le plus heureux des Front-end avec Gulp.js
 
Madison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small TeamsMadison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small Teams
 
Npm scripts
Npm scriptsNpm scripts
Npm scripts
 
Automated Development Workflow with Gulp
Automated Development Workflow with GulpAutomated Development Workflow with Gulp
Automated Development Workflow with Gulp
 
Frontend Build Tools - CC FE & UX
Frontend Build Tools - CC FE & UXFrontend Build Tools - CC FE & UX
Frontend Build Tools - CC FE & UX
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngine
 

Similar to Using the Command Line: Bash and WP-CLI

Scaling Development Environments with Docker
Scaling Development Environments with DockerScaling Development Environments with Docker
Scaling Development Environments with Docker
Docker, Inc.
 
10 Million hits a day with WordPress using a $15 VPS
10 Million hits a day  with WordPress using a $15 VPS10 Million hits a day  with WordPress using a $15 VPS
10 Million hits a day with WordPress using a $15 VPS
Paolo Tonin
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
Cassandra Day Atlanta 2015: Software Development with Apache Cassandra: A Wal...
Cassandra Day Atlanta 2015: Software Development with Apache Cassandra: A Wal...Cassandra Day Atlanta 2015: Software Development with Apache Cassandra: A Wal...
Cassandra Day Atlanta 2015: Software Development with Apache Cassandra: A Wal...
DataStax Academy
 
How to stay sane during your Vagrant journey
How to stay sane during your Vagrant journeyHow to stay sane during your Vagrant journey
How to stay sane during your Vagrant journey
Jakub Wadolowski
 
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.
Nat Weerawan
 
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
Ciklum Ukraine
 
Optimizing Your CI Pipelines
Optimizing Your CI PipelinesOptimizing Your CI Pipelines
Optimizing Your CI Pipelines
Sebastian Witowski
 
Kubecon seattle 2018 workshop slides
Kubecon seattle 2018 workshop slidesKubecon seattle 2018 workshop slides
Kubecon seattle 2018 workshop slides
Weaveworks
 
Queue Everything and Please Everyone
Queue Everything and Please EveryoneQueue Everything and Please Everyone
Queue Everything and Please Everyone
Vaidik Kapoor
 
Docker
DockerDocker
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
Pablo Godel
 
Chaos Practice in PingCAP
Chaos Practice in PingCAPChaos Practice in PingCAP
Chaos Practice in PingCAP
PingCAP
 
Testing Your Automation Code (Vagrant Version)
Testing Your Automation Code (Vagrant Version)Testing Your Automation Code (Vagrant Version)
Testing Your Automation Code (Vagrant Version)
Mischa Taylor
 
Power up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShiftPower up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShift
Shekhar Gulati
 
Using Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutionsUsing Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutions
Sander van der Burg
 
Percona: Integrate PMM within an existing monitoring platform
Percona: Integrate PMM within an existing monitoring platformPercona: Integrate PMM within an existing monitoring platform
Percona: Integrate PMM within an existing monitoring platform
Rachid Zarouali
 
Introction to docker swarm
Introction to docker swarmIntroction to docker swarm
Introction to docker swarm
Hsi-Kai Wang
 
Docker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notesDocker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notes
Sreenivas Makam
 
Vagrant. Halturin Artem
Vagrant. Halturin ArtemVagrant. Halturin Artem
Vagrant. Halturin ArtemADCI Solutions
 

Similar to Using the Command Line: Bash and WP-CLI (20)

Scaling Development Environments with Docker
Scaling Development Environments with DockerScaling Development Environments with Docker
Scaling Development Environments with Docker
 
10 Million hits a day with WordPress using a $15 VPS
10 Million hits a day  with WordPress using a $15 VPS10 Million hits a day  with WordPress using a $15 VPS
10 Million hits a day with WordPress using a $15 VPS
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Cassandra Day Atlanta 2015: Software Development with Apache Cassandra: A Wal...
Cassandra Day Atlanta 2015: Software Development with Apache Cassandra: A Wal...Cassandra Day Atlanta 2015: Software Development with Apache Cassandra: A Wal...
Cassandra Day Atlanta 2015: Software Development with Apache Cassandra: A Wal...
 
How to stay sane during your Vagrant journey
How to stay sane during your Vagrant journeyHow to stay sane during your Vagrant journey
How to stay sane during your Vagrant journey
 
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.
Create connected home devices using a Raspberry Pi, Siri and ESPNow for makers.
 
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
 
Optimizing Your CI Pipelines
Optimizing Your CI PipelinesOptimizing Your CI Pipelines
Optimizing Your CI Pipelines
 
Kubecon seattle 2018 workshop slides
Kubecon seattle 2018 workshop slidesKubecon seattle 2018 workshop slides
Kubecon seattle 2018 workshop slides
 
Queue Everything and Please Everyone
Queue Everything and Please EveryoneQueue Everything and Please Everyone
Queue Everything and Please Everyone
 
Docker
DockerDocker
Docker
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Chaos Practice in PingCAP
Chaos Practice in PingCAPChaos Practice in PingCAP
Chaos Practice in PingCAP
 
Testing Your Automation Code (Vagrant Version)
Testing Your Automation Code (Vagrant Version)Testing Your Automation Code (Vagrant Version)
Testing Your Automation Code (Vagrant Version)
 
Power up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShiftPower up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShift
 
Using Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutionsUsing Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutions
 
Percona: Integrate PMM within an existing monitoring platform
Percona: Integrate PMM within an existing monitoring platformPercona: Integrate PMM within an existing monitoring platform
Percona: Integrate PMM within an existing monitoring platform
 
Introction to docker swarm
Introction to docker swarmIntroction to docker swarm
Introction to docker swarm
 
Docker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notesDocker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notes
 
Vagrant. Halturin Artem
Vagrant. Halturin ArtemVagrant. Halturin Artem
Vagrant. Halturin Artem
 

Recently uploaded

Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 

Recently uploaded (20)

Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 

Using the Command Line: Bash and WP-CLI

  • 1. Using The Command Line: Bash And WP-CLI NERDY GOODNESS 🙂 https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 2. Why Use CLI? • Repeatable Tasks • Browsers Time Out • Great For Mashing Commands Together • All The Cool Kids Are Doing It https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 3. Getting Started • Mac: Applications -> Utilities -> Terminal -> Done! • Windows: Download Bash git-scm.com-> install -> Done! • Also Windows: Configure Linux Subsytem https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 4. Navigating Commands pwd Present Working Directory ls List Directory cd Change Directory ~ Home Directory - Last Directory ../ Parent Directory ./ Current Directory / System Root Anatomy of a Command Syntax: <command> [Options] [Parameter1…2] HINT! Press `tab` to autocomplete paths. https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 5. File/Directory Management Commands touch Create a file mkdir Make a Directory cp Copy files/directories mv Move files/directories rm Remove a file rmdir Remove a Directory Recursively Removing Directories and Files: rm -rf ~/trash_folder BE CAREFUL… THERE IS NO UNDO! > File Write to file >> File Append to file cat Read file less Convert a string to pages wc Word Count https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 6. Useful Commands & Pipes find Find files or folder grep Search String tail Get the last lines of a file xargs Convert output to args uniq | sort Sort and remove duplicates Piping Commands: find -name "*.sql" | uniq | sort | wc –l Command returns STDOUT | command consumes STDIN returns STDOUT |…so on… STDIN Output of a function STDIN Input from a pipe | Pipe, used to chain functions https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 7. A Little Beyond the Basics apt-get Install packages sudo Super User Do curl/wget GET/POST Requests pv mySQL progress bar • git • npm • ponysay? Useful Packages Installing Packages: Mac: Use Brew Linux: apt-get apt-get Command: [sudo] apt-get install git [sudo] apt-get install nodejs [sudo] npm install json pv Command: pv file.sql | mysql -u -p <database> https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 8. WP-CLI | mklife easier https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 9. WP-CLI Requirement • Bash • PHP 5.3.29 • SSH (if not local) Install Instructions curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar chmod +x wp-cli.phar sudo mv wp-cli.phar /usr/local/bin/wp
  • 10. Syntax: wp <command> [subcommand] [Options] Anatomy of a WP-CLI Command All WP-CLI Commands https://developer.wordpress.org/cli/commands/ https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 11. Some Useful Simple WP-CLI Commands Deactivate all plugins: wp plugin deactivate --all Regenerate thumbnails: wp media regenerate --yes Update all plugins: wp plugin update --all Update all themes: wp theme update --all #delete unused themes Update WP Core: wp core update Clear the object cache: wp cache flush Delete all transients: wp transient delete --all https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 12. Some Advanced CLI Info • Bash is a complete language! • Loops, Arrays, Conditionals • https://gist.github.com/mgratch https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 13. More topics Permissions chmod, chown, permission codes. System Health df, du, top, htop Task runners & package managers Grunt, Gulp, Webpack, composer, npm https://marcgratch.com | mgratchWordCamp Birmingham 2018
  • 14. Great Resources wptavern.com wp-cli.org tommcfarlin.com poststatus.com make.wordpress.org pippinsplugins.com joshpress.net wordpress.tv carriedils.com tuts+ wpchat.com carlalexander.ca torquemag.io wpbeginner.com yoast.com wpshout.com wpmayor.com gravitywiz.com wplift.com chrislema.com webdevstudios.com training.leftlogic.com javorszky.co.uk developer.wordpress.org https://marcgratch.com | mgratchWordCamp Birmingham 2018

Editor's Notes

  1. Open terminal Show current directory & pwd & ls cd www/marcgratch Go back to the start directory cd – Go ~ Go back –
  2. touch file.txt echo “Hello” > file.txt cat file.txt echo “World” >> file.txt cat file.txt mkdir folder cp file into folder rm file.txt rmdir folder mv folder/file.txt ./ rmdir folder cat test.txt cat test.txt | less | wc
  3. find –name “*.sql” grep "none" test.txt tail htdocs/wp-content/debug.log -f // find all files, search for just sql files, only get the unique file names, and copy them into the test folder find . | grep "\.sql$" | uniq | sort | xargs -I file cp file ./test_backup/
  4. Switch to vagrant sudo apt-get git git status sudo apt-get nodejs npm npm install json –g curl https://2018.birmingham.wordcamp.org/wp-json/wp/v2/sessions/2320 curl https://2018.birmingham.wordcamp.org/wp-json/wp/v2/sessions/2320 | json title.rendered
  5. // backup and build new site with random content curl https://gist.githubusercontent.com/mgratch/c241c54df23a5d6ca294a83b15e2a5ec/raw/11d66564a24eee1e0b0eed0866efd1651e214df8/reset_restore_site.sh // replace featured images with random gifs https://gist.githubusercontent.com/mgratch/cf6e58e5d8ce2861762b7408021d1f83/raw/0a4241f0d72f571b7a17b2b6aee7c6a8f27a33fc/random-featured-images.sh //pull live site data, fix it & insert it into local data curl https://gist.githubusercontent.com/mgratch/a1f4117e92abfca0bb54dae39279e42b/raw/d4973717a6c0da1fc856360fdcf6cef9201b4e9f/fix-migrate-live-data-on-staging.sh // replace short codes with html, demo arrays in bash curl https://gist.githubusercontent.com/mgratch/e0cc0a07cddc6f42434f6a6e07516ea6/raw/f95f9e292bd992dd9d730276e38782333515a7f7/replace-shortcodes-with-html.sh // Make first 4 posts featured while marking the rest as not featured, demo conditionals curll https://gist.githubusercontent.com/mgratch/a5c486d4f9edd7e2e2b3c073fcbf1910/raw/efbc3c261352fe342bda3fbf5acabdc9654a65df/set-4-featured_post.sh