There is a very useful command line tool called which. This tool determines which file will be executed when you type it. Unfortunately, this command can sometimes provide the wrong answer. Newest Update: I was using bash as my terminal shell when I wrote this article. Now, I’m using zsh and with this shell the […]
command line
Using Vim to View Git Commits
This tweet blew my mind. $ git log | vim -R –Now press <K> on a commit hash. — Luke Diamand (@LukeDiamand) February 21, 2018 I spend a lot of my time in Vim and Git and this is an amazing combination of the two. While I love this command, I think we can do […]
Install Multiple WordPress Plugins with WP CLI
At a recent WordPress meetup we were discussing WP CLI and the comment came up, “When setting up a site, it would be nice to install a bunch of plugins with a single command.” Fortunately a WordPress meetup is a great place to bounce ideas off of smart people and find a solution. Solution 1: […]
Search WordPress Post and Post Meta
Recently, I had to find instances of where specific Gravity Forms were being used. This came with multiple challenges. Challenges Searching for gravityform id=”7″ returns results for just gravityform (i.e. too many results) If the gravity form appears in post meta (rather than the primary content), it is excluded (i.e. missing results) SQL Solution Find […]
How To Use Git Bisect
Historically, when trying to track down a bug in my code I spent a lot of time trying to determine exactly where the bug appears in the code. On all of my projects I use Git for version control. Knowing exactly which commit introduced the bug helps me track down the bug. Git bisect is […]
Git Case Sensitive Rename
One can rename a file with git mv however, if you try to use this technique to change the case of the filename it will fail and you’ll get fatal: destination exists. I prefer to keep all my filenames lowercase, so getting this to work is important to me. If I modified the filename case […]
Replace Across Multiple Files
Replace All Instances of wolf with dog From the command line run ack ‘wolf’ -l –print0 | xargs -0 sed -i ” ‘s/wolf/dog/g’
Command Line List Files in Tree View
List all subfolders with formatted output ls -R | grep “:$” | sed -e ‘s/:$//’ -e ‘s/[^-][^\/]*\//–/g’ -e ‘s/^/ /’ -e ‘s/-/|/’ From: http://reviews.cnet.com/8301-13727_7-10402034-263.html