chkconfig with color on centos

alias chkconfig=”chkconfig | perl -pe ‘use Term::ANSIColor; s/\bon\b/color(\”green\”).on.color(\”reset\”)/ige;’”

or to permit passing an agrument:

function chkconfig(){ /sbin/chkconfig $* | perl -pe ‘use Term::ANSIColor; s/\bon\b/color(“green”).on.color(“reset”)/ige;’ }

nano syntax highlighting

nano syntax highlighting

This article describes how to get syntax highlighting in the command line emacs editor “nano“

Ubuntu zcat /usr/share/doc/nano/examples/nanorc.sample.gz > ~/.nanorc sed -i ‘s|# include|include|g’ ~/.nanorc Centos/Redhat cp /usr/share/doc/nano-2.0.9/nanorc.sample ~/.nanorc sed -i ‘s|# include|include|g’ ~/.nanorc

my bash prompt


Modify ~/.bashrc and append this line

PS1=”\n\[\e[32;1m\][\[\e[37;1m\]\[email protected]\h:\[\e[37;1m\]\w\[\e[32;1m\]]\\$ \[\e[0m\]” My Bash Prompt

Setup Email on Centos

To setup email on Centos 6 run these commands yum -y install sendmail mailutils chkconfig –levels 235 sendmail on service sendmail restart To send a test email echo “test message” | mail -s “test subject” [email protected] Hosts File

Modify your hosts file and add $HOSTNAME.local to prevent issues (in example below we are using hostname . . . → Read More: Setup Email on Centos

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!


Your script works when you run it from the console but fails in cron.


Your crontab doesn’t have the right . . . → Read More: Add Current PATH to crontab

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: # Purpose: securely self-deleting shell script # currentscript=$0 # function that is called when the script exits . . . → Read More: self deleting bash script

Install byobu Ubuntu Precise

To fix the infinite scrolling issue with byobu and Ubuntu precise install it the following way:

apt-get install byobu echo “at the next prompt select ‘screen’ as the backend” byobu-select-backend

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

In this case we are adding 0x4f000 and 0×2000

$ printf “0x%X\n” $(( 0x4f000+0×2000 )) . . . → Read More: Howto Add Hex Numbers via Command Line

How to Send Mail From Ubuntu Precise


To send mail from the command line in Ubuntu Precise

sudo apt-get install mailutils

If you mess up configuring or want to reconfigure

dpkg-reconfigure mailutils Sending your test email

Let’s send a test email!

echo “test email body” | mail -s “test email subject” [email protected] Debugging issues tail -f /var/log/mail.err tail -f /var/log/mail.log Config . . . → Read More: How to Send Mail From Ubuntu Precise

Logstash Logrotate Howto


I was facing two problems with my Logstash setup

Logstash service constantly required manual restarts (no longer indexing, hanging process) Local log files were filling up my root partition Symptom

Logstash failed to:

Index events in the queue Trim its own logs =) Cause Indexing

I’m not sure why it was failing to index. . . . → Read More: Logstash Logrotate Howto