

They are not exactly the same. I always default to piping it, because I never remember which to use when. And had to lookup again to make sure I was not hallucinating: https://unix.stackexchange.com/questions/76049/what-is-the-difference-between-sort-u-and-sort-uniq/76095#76095
I’m actually not sure what you mean by that. This script will only list the programs you used in the terminal. It prints the fullpath of each command. That’s all it does.
Do you want know if a program is currently running?