In linux the basic ps
command only shows very basic information about the processes running in the same terminal.
For example:
[root@localhost ~]# sleep 100 &
[1] 4071
[root@localhost ~]# ps
PID TTY TIME CMD
4025 pts/2 00:00:00 bash
4071 pts/2 00:00:00 sleep
4078 pts/2 00:00:00 ps
[root@localhost ~]#
What is the way to achieve the same simple output in mac?
The ps without any options in mac, prints a lot more information than processes running in the same terminal.
Apparently there is no ps port from linux to mac for a good reason
About the ps that I have : Running El Capitan 10.11.6
$ which -a ps
/bin/ps
$ ps --version
ps: illegal option -- -
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
[-g grp[,grp...]] [-u [uid,uid...]]
[-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
ps [-L]
Some example output
$ /bin/ps | wc -l
69
$ ps | grep iTerm
2462 ttys000 0:00.20 /Applications/iTerm.app/Contents/MacOS/iTerm2 --server /usr/bin/login -fpl hbaba /Applications/iTerm.app/Contents/MacOS/iTerm2 --launch_shell
4157 ttys001 0:00.19 /Applications/iTerm.app/Contents/MacOS/iTerm2 --server /usr/bin/login -fpl hbaba /Applications/iTerm.app/Contents/MacOS/iTerm2 --launch_shell
4241 ttys002 0:00.20 /Applications/iTerm.app/Contents/MacOS/iTerm2 --server /usr/bin/login -fpl hbaba /Applications/iTerm.app/Contents/MacOS/iTerm2 --launch_shell
4296 ttys003 0:00.20 /Applications/iTerm.app/Contents/MacOS/iTerm2 --server /usr/bin/login -fpl hbaba /Applications/iTerm.app/Contents/MacOS/iTerm2 --launch_shell
4380 ttys004 0:00.20 /Applications/iTerm.app/Contents/MacOS/iTerm2 --server /usr/bin/login -fpl hbaba /Applications/iTerm.app/Contents/MacOS/iTerm2 --launch_shell
4456 ttys005 0:00.21 /Applications/iTerm.app/Contents/MacOS/iTerm2 --server /usr/bin/login -fpl hbaba /Applications/iTerm.app/Contents/MacOS/iTerm2 --launch_shell