mkdir -p is a command second only to touch in succinct utility. touch creates a file if it does not exist, or updates its timestamp if it does. It's handy if you want to write to a file without checking for its existence, as otherwise you'd need to determine whether or not append is the … Continue reading mkdir -p is your friend
Category: Unix
Startup order of services on RHEL or CentOS
The startup order of services on Red Hat Enterprise Linux (and very likely other flavours) is determined by the numerical prefix on the symbolic links in /etc/rc3.d/ (for run level 3), /etc/rc5.d/ (for run level 5), and so on. When adding a service (chkconfig --add my_service --level 35), you can specify startup order by including … Continue reading Startup order of services on RHEL or CentOS
cpio: chown failed – Invalid argument
I ran into this error while installing the IBM Java RPM on Red Hat Enterprise Linux: error: unpacking of archive failed on file /opt/ibm/java-x86_64-60: cpio: chown failed - Invalid argument The issue is due to /opt/ibm being an NFS mount on the system. There are known issues with running the chown command on NFS 4. … Continue reading cpio: chown failed – Invalid argument
Linux Basics: Navigate with ls, cd, and pwd
The Linux command line can be a bit intimidating at first, but it gets much easier once you learn a few basic building blocks. The power of the command line lies in combining many basic commands in interesting ways. Open up a Linux terminal (or, if you want to follow along on Windows, Cygwin). The … Continue reading Linux Basics: Navigate with ls, cd, and pwd
Find out your SLES version and service pack level from command line
I recently needed to find out the version of SLES that was running using the command line. This did the trick: cat /etc/SuSE-release
Enable NFS services for HADR
You might need to enable network file system (NFS) services when configuring the High Availability Disaster Recovery (HADR) or Database Partioning (DPF) DB2 features. For example, with HADR, you might want to set up a slave database that shares a backup with the master database through NFS. These commands should enable NFS services on most … Continue reading Enable NFS services for HADR
iptables pitfall
An important thing to remember about rulesets in /etc/sysconfig/iptables is that they are chains. The first rule is applied, followed by the second, and so on. It's the opposite of CSS that way. More specific rules should go first, while all-encompassing rules should go last. I was trying to open the usual DB2 ports on … Continue reading iptables pitfall
device br0 already exists
Here's how you solve either of the following errors on Ubuntu (and possibly Debian): device br0 already exists; can't create bridge with the same name device eth0 is already a member of a bridge; can't enslave it to bridge br1. Removing the device specs from /etc/network/interfaces and restarting the network doesn't actually remove the device … Continue reading device br0 already exists
Disabling PHP in a specific directory
To disable the PHP processor in a given directory, put the following in an .htaccess file. If one doesn't exist, create it. # Disable PHP AddHandler default-handler php RemoveType application/x-httpd-php php # Make .php files display as plain text AddType text/plain php This assumes an Apache server. PHP on IIS may involve different steps. Files … Continue reading Disabling PHP in a specific directory
History meme
Substantial content is in the pipes, but in the meantime here's Arve Bersvendsen's history meme: history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head In my cygwin: 52 python 44 ssh 33 exit 33 cd 18 ls 7 java 5 diff 4 nano 2 ping 1 svn And on a Linux … Continue reading History meme