# make sure access for assistive devices is enabled in the "Universal Access" System Preference open /System/Library/PreferencePanes/UniversalAccessPref.prefPane # cf. Terminal -> Scrollback -> Clear Scrollback [cmd-k] function clear_screen() { /usr/bin/open -a Terminal /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" to keystroke "k" using command down' return 0 } clear_screen # you may use clear instead if scrollback is disabled in Terminal.app defaults read com.apple.Terminal Scrollback defaults write com.apple.Terminal Scrollback -string NO #defaults write com.apple.Terminal Scrollback -string YES kill -HUP $$ [cmd-n] ls -l clear # in addition it may be useful to disable adding commands to the history list #open -e ~/.bash_history #set +o history
Never been to CodeSnippets before?
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
Clear the terminal screen & scrollback buffer (See related posts)
You need to create an account or log in to post comments to this site.
Related Posts
» Terminal window commands in shell osx mac bash unix osascript text window terminal color title bar escape sequence background
» Terminal window commands in shell osx mac bash unix code osascript text window terminal color title bar escape background ansi
» Testing Terminal RGB color c... in shell osx mac bash unix applescript osascript window terminal color rgb combination
» Testing Terminal RGB color c... in shell osx mac bash unix applescript osascript window terminal color rgb combination
» Testing Terminal RGB color c... in shell osx mac bash unix applescript osascript window terminal color rgb combination
» Switch to the login window f... in shell osx mac bash unix window login screen access lock keychain
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails