grep: command not found
Looking at your output, there seems to be an extra space before grep in the error message. I assume this is coming from a still pressed Opt/Alt key after typing the pipe symbol (so you basically are typing Opt-Space instead of just Space). Try ps aux |grep foo (without a space between the pipe and the g).