Category bash
Parse fully qualified domain names from file
I ran in to a situation where i needed to parse all fully qualified domain names (FQDN) from bunch of files in the same directory. Here is how to do that: grep -R -h -Eo ‘(http|https)://[^/”]+’ . | awk -F’/’…
Bulk Lookup Owner of IP Address
To perform a bulk whois lookup of a list of IP addresses use the following script: Bulk whois lookup while read ip; do if [ ! -z “$ip” ]; then echo -n “$ip – ” && whois $ip 2>/dev/null grep…
Howto Use Roku at a Hotel
Using you Roku at a hotel can be problematic because you are unable to accept the terms of service when using the internet. This post explains how to use a Roku at a Hotel. These instructions can be followed pretty…
Add Current PATH to crontab
Add Current PATH to crontab Are you sick of your cron job failing because you are not explicitly listing the full path of everything in your shell script? Here’s how to fix it! Problem Your script works when you run…
self deleting bash script
How to create a bash script that deletes itself This script will delete itself via the shred command (secure deletion) when it exits #!/bin/bash # # Author: Steve Stonebraker # Date: August 20, 2013 # Name: shred_self.sh # Purpose: securely…
Howto Add Hex Numbers via Command Line
Recently I needed to calculate the starting and ending memory addresses of an IOS application (in order to dump it). As a result i needed to figure out how to add two hex addresses. Here’s what I discovered. Basic Example…
Bash Cheat Sheet
Here’s my bash cheat sheet: Tests Combining [ condition ] && action; # action executes if condition is true. [ condition ] || action; # action executes if condition is false. Filesystem related tests We can test different filesystem related…
Whitelist Entire Country with ipset
Goal: Whitelist an Entire Country with ipset For this article i’ll be referencing the github repository I set up at We have a few files there, specifically: * cidr_to_ipset.sh (a script to create an ipset ruleset) * Some example…
passing bash variable to perl command in bash script
Recently I tried passing a bash variable to perl command in bash script, it didn’t end well. Troy Engel from was nice enough to point out the issue: use sed instead of perl for what you need; it’s simpler, faster…