To clear the terminal manually:
⌘+K
Command+K for newer keyboards
To clear the terminal from within a shell script;
/usr/bin/osascript -e ‘tell application “System Events” to tell process “Terminal” to keystroke “k” using command down’
A better way to clear the screen from within a script…
If you’re using the OS X Terminal app (as stated by the OP), a better approach (thanks to Chris Page’s answer to How do I reset the scrollback in the terminal via a shell command?) is just this:
clear && printf ‘\e[3J’ or more concisely (hat tip to user qiuyi):
printf ‘\33c\e[3J’
To delete the last output only:
⌘ + L
To clear the terminal completely:
⌘ + K