Terminal supports an extension of the ED (Erase in Display) escape sequence to erase the scroll-back. It is also supported by xterm. The ED command, described in the VT100 manual, accepts these values for the Ps parameter:
ESC [ Ps J
Parameter Parameter Meaning
0 Erase from the active position to the end of the screen
1 Erase from start of the screen to the active position
2 Erase all of the display
Terminal (and xterm) adds:
3 Erase the scroll-back (aka “Saved Lines”)
Note that this only erases the scroll-back, not the screen. This allows you to erase one or the other, or both by sending two escape sequences.
For example, you can clear the screen and the scroll-back with the following shell command: clear && printf '\e[3J'
(The clear
command looks up the appropriate sequence for clearing the screen for the current terminal, but the “erase scroll-back” escape sequence is custom and must be hard-coded. If you put this in a shell script that you don’t know for certain will only ever be run with Terminal, you should check that $TERM_PROGRAM
is Apple_Terminal
before sending it.)
For an exhaustive list, you can simply do ls for all of the directories in the shell's $PATH
variable--that's what the shell uses to search for a command when you type it.
ls ${PATH//:/ }
The above runs ls
using the path variable as an argument, but with the $PATH
's usual :
separators replaced by a space.
Best Answer
I'm a big fan of Tkinter since it has far more tutorials that help a new person solve real problems and python/tk ship with all Macs and the versions have been stable for years of OS X releases.
To get started, run this command:
If the free tutorials linked above aren't working for your needs, the professional ones on lynda and python classes like https://www.coursera.org/learn/python are fairly easy to get started with limited time or limited funds.
You could also start from the GUI with Platypus and have it call your desired bash scripts for each button that's pressed. You could then open the "app" with open -a to get things started.