Gremlin console hangs or behaves erratically

Tips to use when the Gremlin console hangs or behaves erratically.

The Gremlin console can quit responding if a bad query is entered. Here are some hints for how to regain control:
:clear
This command will clear the current buffer and reset the prompt counter.
:remote config alias reset
This command will reset the graph traversal g to no graph. Use this command before running system commands.
:remote config alias g some_graph.g
This command will reset the graph traversal g to another graph. If queries are hanging in the current graph, switching to another graph allows the console to respond.