The Computer Oracle

How to open a clean terminal in Mac OS X Lion?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Popsicle Puzzles

--

Chapters
00:00 How To Open A Clean Terminal In Mac Os X Lion?
00:31 Answer 1 Score 10
00:43 Accepted Answer Score 4
01:08 Answer 3 Score 9
01:30 Answer 4 Score 7
01:37 Thank you

--

Full question
https://superuser.com/questions/315174/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#terminal #osxlion

#avk47



ANSWER 1

Score 10


From my own experience, when I disabled Lion's Resume feature, this stopped Terminal storing session history.




ANSWER 2

Score 9


Lion's window resume feature is set on an application by application basis. You can stop this in Terminal with the following command:

defaults write com.apple.Terminal NSQuitAlwaysKeepsWindows -bool false

Because you're editing the Terminal settings while having Terminal open, you'll need to close and restart Terminal twice before seeing the effect.




ANSWER 3

Score 7


Command-K clears the Scrollback.




ACCEPTED ANSWER

Score 4


Add the following at the very end of .bash_profile:

printf '\033c'

This will really clear the Terminal. I even defined the following function, since I didn't like the scrolling behavior of the default clear:

function clear {
    printf '\033c'
}

I think it's the same as a hard reset of the Terminal (Cmd-Opt-R), but I'm not entirely sure.