Curly brace expansion in the Bash shell

A very handy trick using the Bash shell in Linux involves the curly braces. The Bash manual at defines brace expansion as "a mechanism by which arbitrary strings may be generated."

I use this mostly when working with files, especially making back ups of configuration files. For example, to copy /etc/X11/xorg.conf to /etc/X11/xorg.conf.backup, you could do this:

$ cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

or you could use brace expansion

Get unique lines in file using bash

I had to take a closer look at a distributed attack on one of our web servers today. The attack only involved around 50 hosts which seemed to be testing our URL parameters for injection susceptibility. Coldfusion has some protection against SQL injection, and we take extra steps, as every programmer should, to guard against it.

After identifying the attack vector, I was able to grep the log file for the signature of the attack which was present in the URL information.

Subscribe to RSS - bash