Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Basics (Retired) Ruby Numbers Different Kinds of Numbers

clear screen

How do you clear the screen when in the ruby console?

14 Answers

There are two ways to clear a screen. You could type in 'clear' then press enter or press the command key cmd + letter 'L' on the keyboard; if using the mac. I guess on windows you can replace command key with control key on the keyboard.

On windows, in the Interactive Ruby command terminal, the only command that has worked for me is

system('cls')

for example, type:

irb(main):091:0> system('cls')

Ctrl + L does not seem to work.

(control + l) on mac....

This actually requires two steps if you're in irb.

If you're using workspaces on a Mac, type 'exit' to leave irb, and then type 'clear' to clear the screen.

This works on Windows as well. Thank you.

This action will cause you to lose all the work in irb.

OMG! Took me forever to find this answer! Thank you!!!!

hi, if you are on Windows, inside IRB you should type system('cls') like this:

irb(main): 007:0>system('cls')

Yes, that's it! Thank you. In the ruby console (irb), on the Mac, ctrl+l (control + lower case L) clears the screen. The "clear" command will clear screen in Workspaces, but not in the ruby console.

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

I use the "clear" command.

It doesnt work but ctr + l yes

To clear the screen in the Treehouse workspaces irb, type

(for Mac)

ctrl + L

OR

system('clear')

(for Windows)

ctrl + L

I'm still having trouble clearing once irb is open

command + l is not working on my macbook

I want to keep all the items I am working on in workspaces while in irb, but the clear command does not work. If I quit irb I go back to the default and relaunch irb, my previous work got erased. Hope somebody can help on this one as I think this was not covered on the video.

I tried to look it up and it seems like that's not something that can be done in Windows. It only works on Linux and Mac.

I know this is a really old question but if anyone looks. On windows system 'cls' works.

Its actually ctrl + L

CMD + l doesnt work.

EDITED: Typing "clear" doesn't work in the irb section of the console.

I'm using Windows and ctrl and "L" does work, thank you!

On the mac you can also type 'quite' or 'exit' Try those.

How do I clear screen in Treehouse workspaces irb? ctrl+L and clear do not work.

On windows, the only command that has worked for me is

system('cls')

irb(main):091:0> system('cls')