Linux Tutorials

git – how to diff two branches

It is sometimes useful to be able to diff two branches in git. This can be useful to understand the changes in a git repository read more

Find all user created wordpress custom field keys

Sometime we need to find all user created custom field key names (or meta key) in wordpress. This may be needed to find all posts read more

find if a wordpress page is leaf page

Sometime we want to consider pages which have children as browse pages and may treat them separately in plugins etc. For example we may not read more

How to display wordpress top level pages

Displaying wordpress top level pages may be useful for displaying sitemap or browse interface on a wordpress site. Here is the code you can use read more

DIG quick start tutorial for DNS Lookup

Dig (Domain information groper) can be used to do DNS lookup on Linux, Mac or windows machine. It will connect a DNS server (default or read more

Setup xdebug for remote wordpress debugging

Using xdebug is pretty useful for debugging and sometimes understanding existing code. In a typical setup where wordpress in installed remotely on EC2 or any read more

How to upgrade wordpress manually

Recently I upgraded wordpress from version 3.5.1 to 4.3.1. There are couple of ways you can upgrade wordpress and easiest one is do it using read more

Edit a file without changing its timestamp on Linux

Usually anytime a file a edited, its timestamp is also changed. There are cases when you want to change the content of a file but read more

migrate multiple mysql databases using mysqldump on Linux

Sometimes we need to migrate all mysql databases to a new machine. This can be the case when you are migrating your multiple wordpress blogs read more

How to zip/unzip a directory with password

Zip and unzip utility can be used to compress a file or directory on Mac. These should also work on Ubuntu or other Linux flavours. read more

How to install drupal on Mac usin MAMP

Drupal is an open source popular cms system powering millions of websites and applications. This article covers how to install Drupal on Mac using MAMP. read more

How to use rrdtool plot traffic from network interface

rrdtool open source tool is used to log time series data and create nice graphs form that data. Official information can be obtained from rrdtool‘s read more

Mongo – cli quick start guide

Using mongo cli utility can be handy way to query mongo db and automate few simple use cases. This article covers some handy commands which read more

Ngrep – quick start guide

Ngrep is similar to tcpdump with ability to look for regex search in packets playload and show matching packets to screen. This can be very read more

Some handy linux gnu date commands

Using date command is pretty handy way to covert unix timestamp to string format and vice versa. This can also be used to print unix read more

Linux screen – quick start guide

When working on remote Linux terminals its a good idea to use screen manager as it will protect your session from disconnection. Here are some read more

Memcache – how to dump all keys and values on command line

Memcache is a very simple, distributed memory cache used widely with mysql and other databases. Often we want to inspect what is in memcache server read more

redis cli tutorial for beginners

Redis is a fast key value cache and store. It is useful to get familiar with some handy redis command line interface (cli) commands. Here read more

How to use phantomjs to create site/url snapshot thumbnail

PhantomJS in a scriptable webkit written by Ariya Hidayat. Chrome and Safari are based on webkit. This is the formal definition as per the official site: PhantomJS is read more

How to Preload cache in wordpress on Linux

I’m using memcache with w3c total cache plugin to cache pages on my wordpress site on Ubuntu Linux. The way it works is whenever someone read more

How to find recursion stack growth direction using C code

In a Linux (or other Operating System) process when a subroutine is called, the memory for local variables comes from stack area of the process. read more

How to use rsync for production release automation

Rsync can be used to automate the production releases for wordpress or any other site. I maintain two wordpress sites – one for development purpose and one read more

How to automate wordpress sandbox setup on Linux

Maintaining a wordpress site can be pretty involving task specially when you have so many plugins with regular updates. Many time you have to experiment new plugins, read more

How to fix mysql service stopping intermittently on AWS micro instance

I was having this problem since last few days. My mysql server was getting killed on its own on aws/ec2 micro instance. So far I read more

How to use nc (netcat) to print headers sent by a browser

Unix utility nc (netcat) is a pretty handy utility for many network tasks. One such use is to see what headers are being sent by read more

How to migrate wordpress from root to sub directory

Migrating wordpress from root to subdirectory is not a difficult task but should be done carefully. Here are the steps which can be followed. Terminology read more

Python/Perl/Unix one liners

Here are some cool python one liners. Parse apache log using python: print 5th field python -c “import csv,sys;f=csv.reader(sys.stdin, delimiter=’ ‘); print ‘\n’.join([r[5] for r read more