Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On the terminal prompt for OS X I can type in echo $'\ec' and ti will clear the console. I have no idea why this works, though. What is it doing?

I'm guessing this would work on other versions of linux, too. Can someone shed some light?

share|improve this question

migrated from stackoverflow.com Jun 20 '11 at 11:59

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

2 Answers 2

up vote 1 down vote accepted

\e is the ESC character (0x1B). This is known as an “escape sequence”.

There is a whole list of them on the Internet for the VT100 or ANSI terminal, which you can look at to understand how they work.

FYI, you can do the same thing with printf "\x1bc\n", or clear the screen completely by omitting that final \n.

share|improve this answer

A terminal usually does not have an API per se, so the terminal driver listens for specific sequences of characters being sent to the terminal and takes action based on the sequences received. The ^[c sequence causes the terminal to be cleared, and is just one of many such sequences.

share|improve this answer

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.