diff --git a/doc/api/repl.md b/doc/api/repl.md
index c120bb25efff29..b15fd7ea166b92 100644
--- a/doc/api/repl.md
+++ b/doc/api/repl.md
@@ -43,6 +43,7 @@ The following special commands are supported by all REPL instances:
further input or processing of that expression.
* `.clear`: Resets the REPL `context` to an empty object and clears any
multi-line expression being input.
+* `.cls`: Clear the screen (or press Ctrl+L).
* `.exit`: Close the I/O stream, causing the REPL to exit.
* `.help`: Show this list of special commands.
* `.save`: Save the current REPL session to a file:
diff --git a/lib/repl.js b/lib/repl.js
index fbe85c7b89c0a6..610718a8b48633 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -199,6 +199,12 @@ const {
kAddNewLineOnTTY,
kLastCommandErrored,
} = require('internal/readline/interface');
+
+const {
+ clearScreenDown,
+ cursorTo,
+} = require('internal/readline/callbacks');
+
let nextREPLResourceNumber = 1;
// This prevents v8 code cache from getting confused and using a different
// cache from a resource of the same name
@@ -2144,6 +2150,16 @@ function defineDefaultCommands(repl) {
this.displayPrompt();
},
});
+
+ repl.defineCommand('cls', {
+ help: 'Clear the screen',
+ action: function() {
+ cursorTo(this.output, 0, 0);
+ clearScreenDown(this.output);
+ this.displayPrompt();
+ },
+ });
+
if (repl.terminal) {
repl.defineCommand('editor', {
help: 'Enter editor mode',
diff --git a/test/parallel/test-repl-cls-command.js b/test/parallel/test-repl-cls-command.js
new file mode 100644
index 00000000000000..1b88ccee02f350
--- /dev/null
+++ b/test/parallel/test-repl-cls-command.js
@@ -0,0 +1,22 @@
+'use strict';
+
+require('../common');
+const assert = require('assert');
+const repl = require('repl');
+const ArrayStream = require('../common/arraystream');
+
+// eslint-disable-next-line no-control-regex
+const clearChar = /\[1;1H\u001b\[0J>/;
+let accum = '';
+const output = new ArrayStream();
+output.write = (data) => (accum += data.replace('\r', ''));
+
+const r = repl.start({
+ input: new ArrayStream(),
+ output,
+});
+['new Error', 'Promise'].forEach((cmd) => r.write(`${cmd}\n`));
+assert.strictEqual(accum.match(clearChar), null);
+r.write('.cls\n');
+assert.strictEqual(accum.match(clearChar).length > 0, true);
+r.write('.exit\n');
diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js
index 5e4fac12723b73..b1e2b9c3689c0f 100644
--- a/test/parallel/test-repl.js
+++ b/test/parallel/test-repl.js
@@ -493,6 +493,7 @@ const errorTests = [
expect: [
/\.break/,
/\.clear/,
+ /\.cls/,
/\.exit/,
/\.help/,
/\.load/,