MacOS – Fullscreen a running application from the terminal

fullscreenmacosterminal

I'm trying to pull a prank on a friend. I have a shell script that continuously cats a C source code file so make it look like the terminal is "hacking" something. The next thing I would like to do is have the script make the terminal full screen.

Is there anyway in the default terminal app to make a window full screen based off of a PID or some other identifier?

Best Answer

Use applescript to send the F shortcut:

tell application "Terminal"
    activate
    tell application "System Events" to keystroke "F" using {command down, control down}
end tell

You can use the osascript command to execute applescripts.