Benjamin Cane

A Systems Architect writing about Linux Systems Administration
Picture of Benjamin Cane
Benjamin is a Systems Architect working in the financial services industry focused on platforms that require Continuous Availability. He has been working with Linux and Unix for over 10 years now and has recently published his first book; Red Hat Enterprise Linux Troubleshooting Guide.

In addition to writing about Linux; Benjamin is the creator of Automatron, an infrastructure monitoring and automated remediation application used to create self-healing infrastructure. Benjamin has also spoken at SaltConf 2014 where he presented; Using SaltStack in High Availability Environments.

Latest Articles

Using salt-ssh to install Salt

Using SaltStack's ability to run agentless over SSH to install the salt-minion agent

Creating a swap file for tiny cloud servers

What is swap, and how to use a swap file to add memory to low memory cloud servers

Create self-managing servers with Masterless Saltstack Minions

Using Saltstack's Masterless Minion architecture to create self-managing infrastructure

Using Travis CI to test Docker builds

Walk-through on getting started with Travis CI and how to use Travis CI to test Docker builds

Getting started with Docker by Dockerizing this Blog

This article covers the basic concepts of Docker and how to Dockerize an application by creating a custom Dockerfile

Preventing duplicate cron job executions

This article will show both BASH code and utilities that can be used to prevent a cron job from having multiple running instances

Building Self-Healing Applications with Saltstack

This article will explore creating an application that detects errors and corrects them by integrating Saltstack's API

A Quick and Practical Reference for tcpdump

This article is a quick and practical reference for tcpdump, it covers the basics and dives a little bit into advanced usage. This article should cover everything a systems or network administrator needs to get started and troubleshoot issues quickly

Understanding Exit Codes and how to use them in bash scripts

When writing a script that calls other commands, how do you know if they were successful or not? The answer is exit codes, exit codes are important and this article describes how to use them in your scripts and understand them in general.

Removing packages and configurations with apt-get

Removing an installed package with apt-get isn't as straight forward as you would think. This article walks you through removing a package the right way to allow for re-installation later and how to fix when an install will not deploy configuration files.

Using salt-api to integrate SaltStack with other services

This article will walk you through using salt-api as an entry point for other services to call SaltStack to initiate actions within your infrastructure.

8 Tips for creating better bash scripts

This article covers some simple bash scripting best practices that can be used to improve the quality of your shell scripts.

Using Saltstack to update all hosts, but not at the same time

This article describes several methods of updating salt minions and how to roll out those updates at different times to avoid taking down all hosts at the same time.

Using sysdig to Troubleshoot like a boss

An introduction to sysdig, a new tool for advanced system troubleshooting.

Understanding the kill command, and how to terminate processes in Linux

This article covers the Linux kill command and how it sends signals to terminate processes. Also why you should avoid using kill -9.

Getting around the Linux directory structure with the cd command

An overview of the Linux directory structure and how to move around it with the cd command.

Sending redis traffic through an SSL tunnel with stunnel

This article covers how to secure and encrypt redis traffic by using stunnel. Redis does not by default support SSL encryption, by using stunnel you can forward all redis traffic through a specified SSL tunnel.

Converting files from Windows format to Unix format with dos2unix

This article explains what end of line characters are and how to use dos2unix to convert files that contain Windows EOL characters to a Unix format.

SaltStack: Getting redundancy and scalability with multiple master servers

A how to article on setting up multiple saltstack master servers for redundancy and scalability. With SaltStack you can easily setup 2 or more master servers in a round robin configuration to provide high availability and scalability to your infrastructure automation tools.

8 examples of Bash if statements to get you started

This article shows examples of how to use BASH if statements in scripts and command line. This is a good starter tutorial for those who haven't quite mastered BASH yet.

Using rsync to synchronize a local and remote directory

An introduction to rsync and instructions on how to setup an automated rsync copy between two hosts

Yum Plugins: Verifying packages and configurations with Yum Verify

An introduction to Yum Plugins and Yum Verify

Installing Redis and setting up Master - Slave Replication

A guide on how to install Redis and setup Master - Slave replication between two or more Redis instances

Managing DNS locally with /etc/hosts

An article that explains what the heck the /etc/hosts file is and how you can use it to manage DNS locally

5 Bash for loop examples to make command line tasks more efficient

Examples of bash for loops that can make any shell users life easier

Install RackTables and start tracking your IP address inventory

RackTables is an interesting IT inventory tracking system that can be used to track IP addresses as well as the hardware they are attached to.

Symlinks vs Hardlinks and how to create them

An article that explains the differences between symlinks and hardlinks and how to create them

Changing the default nice value for a user or group

How to make a niceness value default for any user or group using /etc/security/limits.conf

Remote Command Execution with SaltStack

A guide on using the Remote Command Execution abilities of SaltStack

Understanding a little more about /etc/profile and /etc/bashrc

What is the /etc/profile and /etc/bashrc files? What do they do? Read more to find out.

Setting process CPU priority with nice and renice

How to set a CPU priority (niceness) value with the nice and renice commands

Getting started with SaltStack by example: Automatically Installing nginx

A walkthrough on installing and setting up SaltStack using nginx as an example usecase

Finding the OS version & Distribution in Linux

A simple trick on finding out the OS version and Distribution of a Linux system you have command line access to

Reading files in reverse with tac

A cool trick that shows how to read files in reverse with the tac command

Grepping a file without using cat, and other grep tricks

A lot of sysadmins don't realize you can use grep without cat, this article should settle that. It also shows some other grep tricks.

SSH: Disable Host Checking for Scripts & Automation

How to disable SSH host checking for both scripts and lazy users

Adding and Modifying Users and Groups in Linux

An indepth guide on how to create and modify users and some simple tips that make user administration less of a nightmare

mkisofs: Repackaging a Linux Install ISO

Repackaging a Linux installation DVD using mkisofs

ssh-keygen: Creating SSH Private/Public Keys

A how to on generating SSH Private and Public keys and using them for passphrase less logins

EMC PowerPath: superblock could not be read

How to get around a simple setup issue where fsck tries to check a SAN disk before EMC PowerPath starts

Packing and Unpacking files with GNU Tar

Simple guide on using a basic Unix and Linux tool GNU tar

Securely backing up your files with rdiff-backup and sudo

A guide on setting up rdiff-backup and using sudo to run rdiff-backup without running it as the root user

Removing Files and Directories with rm and rmdir

A simple guide on using rm and rmdir some of the basic Shell commands in Linux and Unix environments

Adding and Troubleshooting Static Routes on Red Hat based Linux Distributions

Walkthrough on what Static Routes are and how to add them on Red Hat based Linux Distributions

Websphere MQ Cheat Sheet for System Administrators

A simple cheat sheet that shows commands every sysadmin managing WebSphere MQ could use

Creating a local Yum Repository

A walkthrough on creating your own local Yum Repository and keeping it synchronized automatically

How to force GPFS (or other tools) to connect via an alternate ssh port

A simple solution to force SSH clients to default to a port other than 22

10 nmap Commands Every Sysadmin Should Know

A cheat sheet list of 10 nmap commands that are extremely useful for every Systems or Network Administrator

Mitigating DoS Attacks with a null (or Blackhole) Route on Linux

A guide on how to lessen the damage of a DoS attack by using a null route in Linux

Installing MySQL on Ubuntu/Debian

How to install MySQL on Ubuntu or Debian based Linux Systems using apt-get

NFS: Setting up a basic NFS file system share

Cheat Sheet: Cutting Text with cut

iptables: Linux firewall rules for a basic Web Server

A walkthrough on setting up a basic Linux Firewall for Webservers with FTP, SSH, MySQL and DNS services

Cheat Sheet: Crontab by Example

Advanced Linux System Statistics and Diagnostics with SystemTap

xargs: Build and Execute Commands with Arguments from Standard Input

Troubleshooting High I/O Wait in Linux

A walkthrough on how to find processes that are causing high I/O Wait on Linux Systems

Cheat Sheet: 21 useful find commands

tc: Adding simulated network latency to your Linux server

Sar & Sysstat: Linux Performance Statistics with Ease

Tutorial on installing the sysstat package and using sar to identify performance statistics

When Zombies Invade Linux: What are Zombie Processes and What to do about them

ACL: Using Access Control Lists on Linux

A tutorial showing how to enable Linux Access Control Lists as well as how to use ACL's to go beyond basic permissions

Stat: Detailed information about a file

Unix Shell: The Art of I/O Redirection

Sysadmin Tools: Managing Linux from a Windows Desktop

Linux Troubleshooting with strace

Sudoedit: Securely allow users to edit files

Why you should avoid running applications as root

Cheat Sheet: systemctl vs chkconfig

A simple cheat sheet that shows how to perform the same task with both systemctl and chkconfig

When it's Ok and Not Ok to use rc.local

An article that discusses when it is appropriate and when it is not appropriate to use the rc.local file. A file that has been depreciated in some Linux distributions.

MySQL: tee saving your output to a file

Learn to use the MySQL tee command to save the MySQL CLI output to a file and to your tty

Creating a new filesystem with fdisk, lvm, and mkfs

Simple walkthrough on how to create a new Linux filesystem using LVM, fdisk and mkfs

Creating a read-only backup user for mysqldump

How to create a read-only user that can be used for MySQL backups with mysqldump

How to check if a cron job ran

This article shows a simple method to validate whether or not a cronjob ran on both Red Hat/Fedora based and Debian based Linux Systems

dscacheutil: Clearing DNS cache on OSX

mysql: Creating a db and user

How to setup a basic mysql database and database user with privileges to only the newly created database

gzip: Restoring original filename

VirtualBox: Mom please stop getting spyware (Cheap VDI)

bind: Checking a zone record for errors

kill: Creating a core dump

bash: Field Separator Variable

mysql: Backup your user privileges

How to backup your mysql privileges to a CSV file

find: Print type of file, inode #, filename and link destination

mount: Disabling execution of scripts

fsck: Force a filesystem check on next reboot

grep: Counting Results

Top: Show CPU Usage on all cores

time: Tracking execution time

dpkg: Listing installed packages

Debian Packages: Installing

apt: Searching for packages

Websphere MQ: saveqmgr

Sudo: Running as a specific user

Find broken Links

find: Remove files modified more than 31 days ago

Sudo: List available commands

ulimit: Checking the user limits of running processes

Find: Print Size, Modify Date, Type, and Filename

Find the biggest directories with du

pstree: Associating Child Processes

sar: System statistics

yes: Repeated Text

runlevel: Check your current runlevel. Then change it

ssh: X11 Forwarding

showmount: See available NFS Shares

Counting with sort and uniq

Filename manipulation with sed, awk and cut

Bash: Repeated tasks with seq and for loops

Yum: Search and Install

Finding what installed a binary with YUM and RPM

SMF: Enable apache [Solaris]

tar: Exclude directories/files

Checking your running kernel version

Truncating a large log file

rpm: Finding dependencies

Quickly creating a CSV file

sudoers: Syntax Checking

Tar: Don't touch existing files

Find files created today

Create/Extract a tar file using contents of a file

Argument list too long

Editing big files on systems with little memory

usermod: Appending to Additional Groups

oom-killer: If you see this you should reboot

mdadm: Manually fail a drive

Do Symlinks use up Inodes?

Bash $RANDOM

The safest way to deploy a crontab

sfdisk Goodies

setfacl: Invalid argument near character

Checking the number of LWP (threads) in Linux

Books I've Written

Red Hat Enterprise Linux Troubleshooting Guide

In this book, you begin with simple troubleshooting best practices and get an overview of the Linux commands used for troubleshooting. The book will cover the troubleshooting methods for web applications and services such as Apache and MySQL. Then, you will learn to identify system performance bottlenecks and troubleshoot network issues; all while learning about vital troubleshooting steps such as understanding the problem statement, establishing a hypothesis, and understanding trial, error, and documentation. Next, the book will show you how to capture and analyze network traffic, use advanced system troubleshooting tools such as strace, tcpdump & dmesg, and discover common issues with system defaults.

Finally, the book will take you through a detailed root cause analysis of an unexpected reboot where you will learn to recover after an unexpected system failure.

Purchase this book