diff --git a/mininet/cli.py b/mininet/cli.py
index f6d752124e4c304b5c628f392cb88cb79f07f8ad..dc531c1433aff4fe504d3a0185905aa5e4a075fb 100644
--- a/mininet/cli.py
+++ b/mininet/cli.py
@@ -400,6 +400,12 @@ def waitForNode( self, node ):
                 # read data but before it has been printed.
                 node.sendInt()
 
+    def precmd( self, line ):
+        "allow for comments in the cli"
+        if '#' in line:
+            line = line.split( '#' )[ 0 ]
+        return line
+
 
 # Helper functions