Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am used to command + k to clear up the terminal in mac. It is very helpful specially while debugging through server logs. What is the equivalent in Ubuntu system ?

share|improve this question

migrated from Jul 12 '11 at 18:45

This question came from our site for professional and enthusiast programmers.

FYI - apparently this is called "clear scrollback" or "clearing the scrollback buffer" and is a function of the terminal program (not the shell, such as bash or zsh). – Nathan Long Jan 18 '12 at 13:53
up vote 5 down vote accepted

Clearing the screen

This will work for both Mac OS X and *nix:


My answer assumes the default terminal emulators for bash, tcsh (default for Mac OS X) or zsh.

Deleting the scrollback buffer (more like ⌘K)

This has been asked/answered elsewhere.

share|improve this answer
can you post please your preferences, and/or something to show HOW you enabled CTRL-L for the clear in the OS X (Because in my Mac CTRL-L does not works). – jm666 Jul 12 '11 at 18:31
It's a bash, tcsh and zsh supported short-cut. It's got nothing to do with – opyate Jul 12 '11 at 18:36
Strange, because it's does not clear for me. I'm using bash --version: GNU bash, version 4.2.0(1)-release (i386-apple-darwin10.7.0) – jm666 Jul 12 '11 at 18:43
Just found the problem source. You must have "set -o emacs" for CTRL-L, (what is default), but i'm using vi-mode. :) – jm666 Jul 12 '11 at 18:50
On my Mac, Control + l inserts a bunch of space below the last output so that the screen appears clear, but you can still scroll up and see the previous output. Command + K, on the other hand, makes it impossible to scroll back to the previous output. Sometimes that is preferable. Do you know how to do the latter on other Unix systems? (Also I don't think bash or zsh are relevant so much as the terminal emulator.) – Nathan Long Jan 18 '12 at 13:56

This is not a key chord, but if you want to clear your terminal and recover it if it gets hosed, you can use the 'reset' command. I know this works in linux and BSD, not sure about OSX.

share|improve this answer
reset works in OSX as well . – Prabesh Shrestha Jan 18 '12 at 14:27

^L - the equivalent to 'clear' command

I guess this is what you were searching for

share|improve this answer
I was searching for a shortcut for clearing up the screen so that whatever comes next will be visible clearly because I don't want to see the previous texts. I use command+K in mac , i set shortcut for clear and reset in ubuntu , that sortof worked for me though. – Prabesh Shrestha Jul 14 '11 at 2:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.