How To Fix Mouse Scrolls the Command Line History Instead of the Window Buffer in Terminal

Author: , May 23rd, 2023

In the macOS Terminal, my mouse scroll wheel would magically start scrolling the command line history instead of the window buffer scroll bar on the right to show window history. This happened when an SSH session was disconnected or timed out. The fix is to run the reset command.

How To Preserve Quotes In Bash Arguments

Author: , April 18th, 2022

If you want to preserve quoting to pass shell arguments to a called command, use the four characters “$@” (including the double quotes) instead of the two characters $*

How To Properly Specify Command and Arguments to Exec in Perl

Author: , December 11th, 2019

When using Perl’s exec() call, the best way to invoke it is as follows:

This syntax does some important things: – passes a scalar value as the first argument which exec interprets as PROGRAM – passes an array as the second argument which exec will use as the arguments to pass into PROGRAM Note […]

Slick Command-Line Tricks for a Tungsten MySQL / MariaDB Database Cluster

Author: , July 16th, 2019

Tungsten Clustering provides high availability, disaster recovery, and a host of other benefits for MySQL / MariaDB / Percona Server databases. In this blog post we will explore some of the shell aliases I use every day to administer various Tungsten Clusters.

How To Restart Apache Using cron If the Load Gets Too High

Author: , February 3rd, 2016

There are times when the hackers slam my servers and the load gets too high. I use a very simple bash script as a cron job to monitor the load and take action when it gets too high. The script will stop httpd, sleep for a configurable period of time (currently 3 minutes), then start […]

How To Eject a Volume from the Terminal Command Line in MacOSX

Author: , December 8th, 2015

As always, YMMV…

How To Auto-Restart Apache If the Load Gets Too High

Author: , September 15th, 2015

The script to check and restart apache…works on CentOS – YMMV!

Add to cron * * * * * /root/restart_apache_if_load_hits_threshold.sh >> /var/log/restart_apache_if_load_hits_threshold.log 2>&1

How To Disable the Bash Terminal Bell

Author: , July 7th, 2015

The Readline library has a bell-style variable that controls what happens when Readline wants to ring the terminal bell. If set to ‘none’, Readline never rings the bell. If set to ‘visible’, Readline uses a visible bell if one is available. If set to ‘audible’ (the default), Readline attempts to ring the terminal’s bell. Edit […]

How To: for loops in bash

Author: , February 27th, 2015

How To Add a Column of Numbers Using AWK

Author: , January 1st, 2015

awk ‘{sum+=$1}END{print sum}’ inputFile