Sort the list of commands.