How to execute Firebug console JavaScript commands from terminal?

Is there a way to execute Firebug console JavaScript commands from the terminal? I need to execute multiple commands. My Firefox/Chrome browser crashes after running more than 100 commands.

No, you can't run browser JavaScript on anything other than... a browser.

If you install NodeJS you can use its JavaScript terminal, but you can't manipulate browser DOM through it for example.