I am writing a BASIC Interpreter for the Command Line in Swift 2, and I cannot find a way to implement the simple command, CLS (clear all text from the Terminal.) Should I s
Use the built-in clear command either with system
system("clear")
or popen (ask Google)
Alternatively, simulate the pressing of Ctrl+L using AppleScript via the command line:
osascript -e 'tell app "terminal" to tell app "system events" to keystroke "l" using {control down}'
EDIT: system is no longer available in newer verions of Swift. See Rudolf Adamkovič's answer.