npm script clear console code example Example 1: clear terminal node js process.stdout.write('\x1Bc'); Example 2: console.log clear screen console.clear()