Unix Shell Script: Convert upper to lowercase text

One command magic: tr ‘[:upper:]’ ‘[:lower:]’ < input.txt > output.txt

Common CentOS Run levels

Common services and their run levels for auto start httpd: chkconfig –level 234 httpd on named: chkconfig –levels 35 named on vsftpd: chkconfig –level 234 vsftpd on -level 234 is fairly common

CentOS: Alias IP Ranges

cd /etc/sysconfig/network-scripts Quick and easy range of ips: Add this file: ifcfg-eth0-range0 Contents: IPADDR_START= 11.xxx.xxx.xxx IPADDR_END= 11.xxx.xxx.xxx CLONENUM_START=0 If you want to add another range: Add this file: ifcfg-eth0-range1 IPADDR_START=10.xxx.xxx.xxx IPADDR_END=10.xxx.xxx.xxx CLONENUM_START=11 Pay close attention to CLONENUM_START. In the second range it must be a number higher than the amount of IPs adding in range0. ...

YUM repo massive update

rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm http://dag.wieers.com/rpm/FAQ.php#B

Perl Single Line – Search and Replace

perl -pi -e ‘s/about news\.$/about selling advertising space\./’ file*

How many cigarette cartons can be brought into the USA?

This is first hand experience! You can bring 1 carton of cigarettes into the USA duty free. Each carton after that is taxed at $10 per carton and it must be paid before leaving Customs/Immigrations to your connecting flight. The process is extremely quick and easy.

FreeBSD: Proper buildworld technique

Follow all these steps in this exact order…this is from hard-won experience!!! 1. cvsup the correct /usr/src – example cvsup files can usually be found in /root/sup. Normally we follow the security releases e.g. RELENG 6_2 rather than stable e.g. RELENG_6 2. read /usr/src/UPDATING to make sure nothing bad is going to happen. 3. rm ...

Routing Hackers To /dev/null (Blackhole)

Add: route add -host attacker_ip 127.0.0.1 -blackhole Remove: route delete -host attacker_ip 127.0.0.1 -blackhole The above will route all traffic from the “attacker_ip” to a blackhole. This is useful when you see someone relentlessly attacking any daemon on your server (ssh, http, ftp, etc). [ad#Google Adsense]

Decrypt SMIME E-Mails – BlackBerry/iPhone

I, and most everyone I deal with, use SMIME e-mail certificates from Verisign/Thawte/Home Brew. Unfortunately, these e-mails can not be viewed on an BlackBerry (without BES) or iPhone. I overcame this by creating an alias on my server that would receive e-mails, decrypt them, and send them back to me -> UNENCRYPTED. [NOTE: If you ...

FreeBSD: Aliasing IPs

[ad#Google Adsense] Edit /etc/rc.conf The primary IP of the machine will be defined by a line that looks similar to this: ifconfig_rl0=”inet 192.168.1.2 netmask 255.255.255.0″ To add additional IPs you simply: ifconfig_rl0_alias0=”inet 192.168.1.3 netmask 255.255.255.255″ ifconfig_rl0_alias1=”inet 192.168.1.4 netmask 255.255.255.255″ [ad#Google Adsense]