Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove all of the typed commands from the command window?

Tags:

r

In R, how to remove all of the typed commands from the command window, so that I can have a clearer working environment.

like image 522
bit-question Avatar asked Dec 07 '11 19:12

bit-question


People also ask

What command removes all commands from the terminal window?

A common way to do that is to use the `clear` command, or its keyboard shortcut CTRL+L.

How do you clear all commands in Matlab?

To clear all variables from the current workspace, use clear or clearvars . To clear all global variables, use clear global or clearvars –global . To clear a particular class, use clear myClass .

How do I clear the Command Window in Matlab?

clc clears all the text from the Command Window, resulting in a clear screen. After running clc , you cannot use the scroll bar in the Command Window to see previously displayed text. You can, however, use the up-arrow key ↑ in the Command Window to recall statements from the command history.

How do I delete all text in terminal?

Clear Terminal via Ctrl+L / Ctrl+Shift+K Shortcut Keyboard shortcuts also work for clearing the terminal, depending on the terminal emulator. An alternative in some terminal emulators is Ctrl + Shift + K .


1 Answers

On windows using RGui, a mac inside the terminal, or on Linux: Ctrl+L will clear the screen for you. You won't be able to scroll up to view what you've done in the session previously though. You can still use the up arrow to scroll through your history though.

On a mac using the gui: Option+Command+L will do the same thing as clearing in the windows gui.

On any system: You could create a function to do something similar to clearing the screen for you:

clr <- function(){cat(rep("\n", 50))}

All this does is prints enough linebreaks to essentially push everything above what is viewable on the console. You can still scroll up to view the previous output but you'll have 50 lines of whitespace. Depending on your monitor size you might need to increase the number of line breaks to clear everything.

like image 187
Dason Avatar answered Sep 22 '22 08:09

Dason