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

Tahseen Malik
Tahseen Malik
16,770 Points

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.

Noah Yasskin
Noah Yasskin
23,947 Points

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.

Nicholas Pourmoradi
Nicholas Pourmoradi
1,910 Points

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.

Russell Christensen
Russell Christensen
4,264 Points

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

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

Ahmed Abbouh
Ahmed Abbouh
17,034 Points

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.

Konrad Pilch
Konrad Pilch
2,435 Points

It doesnt work but ctr + l yes

kabir k
PLUS
kabir k
Courses Plus Student 18,036 Points

To clear the screen in the Treehouse workspaces irb, type

(for Mac)

ctrl + L

OR

system('clear')

(for Windows)

ctrl + L

Anthony c
Anthony c
20,907 Points

I'm still having trouble clearing once irb is open

command + l is not working on my macbook

Alan Fidelino
Alan Fidelino
12,846 Points

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.

Alex Lowe
Alex Lowe
15,147 Points

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.

anthony crowell
PLUS
anthony crowell
Courses Plus Student 10,953 Points

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

Konrad Pilch
Konrad Pilch
2,435 Points

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!

Tahseen Malik
Tahseen Malik
16,770 Points

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

Amy Kang
Amy Kang
17,188 Points

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

Noah Yasskin
Noah Yasskin
23,947 Points

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

system('cls')

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