what is the command+k ( in mac ) equivalent in ubuntu

10,072

Solution 1

Clearing the screen

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

Ctrl-l

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.

Solution 2

^L - the equivalent to 'clear' command

I guess this is what you were searching for

Solution 3

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:
10,072

Related videos on Youtube

Prabesh Shrestha
Author by

Prabesh Shrestha

Software Developer from Nepal currently in Munich. I have been developing web applications mosly with Ruby on Rails and Spring.

Updated on September 18, 2022

Comments

  • Prabesh Shrestha
    Prabesh Shrestha over 1 year

    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 ?

    • Nathan Long
      Nathan Long over 12 years
      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).
  • jm666
    jm666 almost 13 years
    can you post please your Terminal.app preferences, and/or something to show HOW you enabled CTRL-L for the clear in the OS X Terminal.app? (Because in my Mac CTRL-L does not works).
  • opyate
    opyate almost 13 years
    It's a bash, tcsh and zsh supported short-cut. It's got nothing to do with Terminal.app
  • jm666
    jm666 almost 13 years
    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
    jm666 almost 13 years
    Just found the problem source. You must have "set -o emacs" for CTRL-L, (what is default), but i'm using vi-mode. :)
  • opyate
    opyate almost 13 years
    What if you go into Terminal -> Preferences -> Settings -> Keyboard and tick "Use option as meta key"?
  • opyate
    opyate almost 13 years
    Ah, ok :-) Glad you got it working.
  • Prabesh Shrestha
    Prabesh Shrestha almost 13 years
    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.
  • Nathan Long
    Nathan Long over 12 years
    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.)
  • Prabesh Shrestha
    Prabesh Shrestha over 12 years
    reset works in OSX as well .