Bash ‘help’

Some commands you type in the shell are actually not binaries but shell (bash for example) buitins. For example, “alias” is such an shell builtin.

~# type alias

alias is a shell builtin

~# man alias

No manual entry for alias

In order to obtain more information about the “alias” builtin, you should type “man bash” and search what you are looking for in the hundreds of pages long man.

However, there is a quicker way! “help” helps you:

~# help alias

alias: alias [-p] [name[=value] … ]

    Define or display aliases.

    Without arguments, `alias’ prints the list of aliases in the reusable

    form `alias NAME=VALUE’ on standard output.

    Otherwise, an alias is defined for each NAME whose VALUE is given.

    A trailing space in VALUE causes the next word to be checked for

    alias substitution when the alias is expanded.    


      -p Print all defined aliases in a reusable format

    Exit Status:

    alias returns true unless a NAME is supplied for which no alias has been



How to avoid commands being logged in bash history

Maybe if you are not a hacker it’s not very useful, and if you are a hacker you probably already knew this. But hey, just in case it might be useful, I’ll share it with the world.

Normally every command you write it the Bash command line gets recorded in it’s history.

A simple example showing that this is true

[pieter@laptop ~]$ echo “Hey, I’ll end up in the history”
Hey, I’ll end up in the history
[pieter@laptop ~]$ history
2 echo “Hey, I’ll end up in the history”
3 history
[pieter@laptop ~]$

The echo command is logged in the history, as well as the history command itself.

Now, if you do not want the command you execute to be logged in the history, set the following variable:

$ export HISTIGNORE="&:[ ]*:exit"

From now on every command you executed preceded with a space isn’t being logged to the bash history. Useful in case you need to execute a command that has a password as parameter (I know, not very secure…but still).

[pieter@laptop ~]$ [SPACE]echo “I remain unnoticed, hahahahaha”
I remain unnoticed, hahahahaha
[pieter@laptop ~]$ history
2 echo “Hey, I’ll end up in the history”
3 history


Find out the creation date of a MySQL table

Sometimes it’s useful to know when a certain database table was created. For those cases the following statement can be used:

SELECT create_time

In case you are interested in the creation time of a particular table, just add the appropiate WHERE-clause:

SELECT create_time
AND table_name = 'TABLE_NAME'

| create_time         |
| 2011-12-22 12:32:34 |
1 row in set (0.00 sec)

Update: As pointed out below in the comments, it is not possible to know the creation date of a database without access to the directory structure of MySQL.

Boosting I/O throughput of a process

Almost 6 years ago, when Windows Vista was released, I decided to switch to Linux on a day-to-day basis. I had been using Linux before, but was still using Windows on my desktop machine (I know…pretty foolish). The other day I was glad I made that switch a few years ago.

I was creating a HEAP dump, that is a snapshot of all objects in memory, of a JBoss server. A HEAP dump really dumps everything, so if your JBoss (or Tomcat or whatever) process is occupying 4GB of memory, it will dump the whole 4GB in a nice file for you to analyze later on (which is the whole idea behind dumping the HEAP).

Really cool stuff, but not so cool if you see that the dump file only grows 2MB each 10 seconds. What the hell?! I’ll be old and gray before the dump has finished!!! Linux power to the rescue!

The Linux operating system has an I/O scheduler ( that tries to prioritize process I/O requests in the best possible way. It’s clear that it isn’t giving my dump process the highest priority, so let’s tell Linux to do so: Say hi to ionice.

ionice -c class -n classlevel -p PROCESS_ID


1 (real time): First priority is given to the process, regardless of other I/O requests.

2 (best-effort): The default priority class for a process

3 (idle): The process will only get I/O time when no other program has requested I/O time.


A number from 0 to 7 indicating the time slice the process will receive on each scheduling window, where 0 is the highest priority (process gets more I/O time) and 7 is the lowest (process gets less I/O time).

Depending the class and level, the process is given a priority. Beware using the real time priority class as it might choke other processes needing some I/O time.

In my case I used the best-effort class with the highest priority (0). Magic happened, instead of seeing the dump file increased by 2MB per 10 seconds, it was now bumped up to a rate of 10MB/s, AWOOT!!

The importance of disabling auto deploy in JBoss

Recently I was investigating the memory usage of a JBoss application server (I have a post about this pending btw), and while I was preparing everything to launch a stress test, I was surprised to see how the Eden Space kept growing around 80MB each 5 seconds while JBoss was totally idle.

Garbage collection Eden Space

In the above image you can observe how the Eden Space fills up continuously when the autodeployer is activated. Changing the autodeployer’s check period to 60 seconds, we can observe that the Eden Space is filling at a very different rate. Disabling it completely results in almost no growth…

Conclusion: Disable the autodeployer on a production server!

To disable it (at least in JBoss 5), simply delete the following file: