man ps: OSX strikes back.
Pubblicato da Luigi il 29 Marzo 2009 in MacIt seems that man pages on OSX are misaligned with the commands sometime.
Example:
From
$ man ps
I read:
-e Identical to -A.
But look how identical they are:
luigi@noname:~$ ps -e
PID TT STAT TIME COMMAND
12332 s000 S+ 0:00.03 -bash PATH=/usr/bin:/bin:/usr/sbin:/sbin TMPDIR=/var/folders/+K
12376 s001 R 0:00.03 -bash PATH=/usr/bin:/bin:/usr/sbin:/sbin TMPDIR=/var/folders/+K
luigi@noname:~$ ps -A
PID TT STAT TIME COMMAND
1 ?? Ss 0:02.20 /sbin/launchd
10 ?? Ss 0:06.80 /usr/libexec/kextd
11 ?? Ss 0:05.26 /usr/sbin/notifyd
13 ?? Ss 0:12.82 /usr/sbin/ntpd -c /private/etc/ntp-restrict.conf -n -g -p /var/
14 ?? Ss 4:17.86 /usr/sbin/update
15 ?? Ss 0:00.01 /sbin/SystemStarter
17 ?? Ss 0:02.47 /usr/sbin/syslogd
19 ?? Ss 0:01.87 /usr/sbin/securityd -i
21 ?? Ss 2:50.52 /System/Library/Frameworks/CoreServices.framework/Frameworks/Me
22 ?? Ss 0:16.24 /usr/sbin/mDNSResponder -launchd
23 ?? Ss 6:19.50 /System/Library/CoreServices/loginwindow.app/Contents/MacOS/log
24 ?? Ss 0:00.02 /usr/sbin/KernelEventAgent
26 ?? Ss 9:14.55 /usr/libexec/hidd
27 ?? Ss 0:24.74 /System/Library/Frameworks/CoreServices.framework/Versions/A/Fr
29 ?? Ss 0:00.00 /sbin/dynamic_pager -F /private/var/vm/swapfile
32 ?? Ss 0:03.85 /usr/sbin/diskarbitrationd
33 ?? Ss 0:24.93 /usr/sbin/DirectoryService
35 ?? Ss 0:35.43 /usr/sbin/configd
38 ?? Ss 0:00.13 autofsd
39 ?? Ss 0:03.07 /usr/libexec/ApplicationFirewall/socketfilterfw
40 ?? Ss 0:00.02 /Library/Application Support/iStat menus/iStatMenusProcessServe
41 ?? Ss 0:08.00 /usr/sbin/distnoted
44 ?? Ss 0:32.01 /System/Library/CoreServices/coreservicesd
46 ?? Ss 0:03.18 /usr/sbin/blued
104 ?? Ss 90:40.66 /System/Library/Frameworks/ApplicationServices.framework/Framew
138 ?? Ss 0:02.60 /sbin/launchd
142 ?? S 0:00.63 /System/Library/CoreServices/AirPort Base Station Agent.app/Con
146 ?? S 0:06.82 /System/Library/CoreServices/Spotlight.app/Contents/MacOS/Spotl
147 ?? S 0:00.87 /usr/sbin/UserEventAgent -l Aqua
149 ?? Ss 0:06.15 /usr/sbin/coreaudiod
150 ?? S 0:53.94 /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock -psn_
152 ?? U 40:44.63 /System/Library/CoreServices/SystemUIServer.app/Contents/MacOS/
153 ?? S 4:51.92 /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder -
154 ?? S 0:47.90 /System/Library/Frameworks/ApplicationServices.framework/Framew
155 ?? S 0:00.00 /usr/sbin/pboard
165 ?? S 0:00.39 /Users/luigi/Library/Application Support/iStat menus/Helpers/iS
168 ?? S 0:03.39 /System/Library/Frameworks/InstantMessage.framework/iChatAgent.
360 ?? S 0:00.19 /System/Library/Services/AppleSpell.service/Contents/MacOS/Appl
1265 ?? S 0:00.02 /usr/bin/ssh-agent -l
2711 ?? U 8:18.73 /Applications/Path Finder.app/Contents/MacOS/Path Finder -psn_0
9364 ?? S 0:00.20 /Applications/iTunes.app/Contents/Resources/iTunesHelper.app/Co
9366 ?? Ss 0:00.01 /System/Library/PrivateFrameworks/MobileDevice.framework/Versio
12279 ?? SNs 0:01.16 /System/Library/Frameworks/CoreServices.framework/Frameworks/Me
12302 ?? S 3:42.39 /Applications/Firefox.app/Contents/MacOS/firefox-bin -psn_0_747
12315 ?? Ss 0:00.52 /System/Library/Frameworks/ApplicationServices.framework/Framew
12330 ?? S 0:17.35 /Applications/iTerm.app/Contents/MacOS/iTerm -psn_0_7513898
12352 ?? S 0:02.56 /Applications/VirtualBox.app/Contents/MacOS/VBoxSVC --pipe 8 --
12353 ?? S 0:00.36 /Applications/VirtualBox.app/Contents/MacOS/VBoxXPCOMIPCD
12373 ?? S 0:02.01 /Applications/VirtualBox.app/Contents/MacOS/VirtualBox -psn_0_7
12476 ?? S 0:08.90 /Applications/Preview.app/Contents/MacOS/Preview -psn_0_7583547
12331 s000 Ss 0:00.02 login -fp luigi
12332 s000 S+ 0:00.03 -bash
12375 s001 Ss 0:00.01 login -fp luigi
12376 s001 S 0:00.03 -bash
12530 s001 R+ 0:00.00 ps -A
Always from "man ps" I read:
-f Display the uid, pid, parent pid, recent CPU usage, process start time, controling tty,
elapsed CPU usage, and the associated command. If the -u option is also used, display
the user name rather then the numeric uid. When -o or -O is used to add to the display
following -f, the command field is not truncated as severely as it is in other formats.
Look how nice this option works:
luigi@noname:~$ ps -f
ps: illegal option -- f
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
[-u]
[-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
ps [-L]
I noticed that those two options are not working because usually to check the PID of a process on linux I use the command "ps -ef". Both -e and -f don't work as expected on OSX. 100% failure.
Now I wonder where I have to read to know how the damn ps works on OSX.
Apple, next time, use Linux as base for your OS. At least man pages will reflect the commands. OSX really sucks.
I'm praying that Ubuntu will soon have a good hardware support for my macbook.
2 Commenti a “man ps: OSX strikes back.”
Lascia un Commento
Cerca
Calendario
| L | M | M | G | V | S | D |
|---|---|---|---|---|---|---|
| « Feb | Apr » | |||||
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 | |||||
Archivi
- Gennaio 2010 (2)
- Dicembre 2009 (1)
- Novembre 2009 (3)
- Settembre 2009 (2)
- Agosto 2009 (4)
- Luglio 2009 (1)
- Giugno 2009 (2)
- Maggio 2009 (4)
- Aprile 2009 (2)
- Marzo 2009 (7)
- Febbraio 2009 (5)
- Gennaio 2009 (2)
- Dicembre 2008 (1)
- Novembre 2008 (8)
- Ottobre 2008 (12)
- Settembre 2008 (3)
- Agosto 2008 (2)
- Luglio 2008 (6)
- Giugno 2008 (16)
- Maggio 2008 (2)
- Aprile 2008 (3)
- Marzo 2008 (6)
- Ottobre 2007 (1)
- Settembre 2007 (1)
- Agosto 2007 (5)
- Luglio 2007 (6)
- Giugno 2007 (6)
- Maggio 2007 (1)
- Marzo 2007 (1)
- Febbraio 2007 (2)
- Gennaio 2007 (1)
- Dicembre 2006 (2)
- Novembre 2006 (4)
- Ottobre 2006 (7)
- Settembre 2006 (1)
- Agosto 2006 (2)
- Luglio 2006 (6)
- Giugno 2006 (3)
- Febbraio 2006 (1)
- Gennaio 2006 (1)
- Dicembre 2005 (5)
- Novembre 2005 (2)
- Ottobre 2005 (2)
- Settembre 2005 (7)
- Agosto 2005 (2)
- Luglio 2005 (8)
- Giugno 2005 (12)
Categorie
- Books (7)
- Eclipse (10)
- Errors (2)
- Firefox (7)
- Hardware (14)
- Horror Code (8)
- Internet (17)
- Java (85)
- JavaScript (8)
- Life, universe and everything (29)
- Linux (44)
- Mac (18)
- Software (25)
- Speeches and Conferences (8)
- Web (19)
- Windows (16)
Ultimi Post
- Syntactic sugar and Java arrays.
- 3G USB Stick on Ubuntu
- Ipod touch with Linux
- Karmic and Luks: USB drive encryption made (almost) easy
- Suspend/Resume in Karmic /2
- Suspend/Resume problem in Ubuntu Karmic 9.10 running on MacBook Pro 5.1
- MacBook International Keyboard and Linux
- Mighty Mouse: reverse horizontal scrolling workaround on Ubuntu Linux 9.04
- Skype 2.1.0.47 beta released, and amd64 packages available!
- Linux RAM Disks
My open source projects
Blog License
Blogs I like
Friends' Blogs
- Antonio Terreno & Valter Bernardini
- Bruno Bossola
- Daniele Galluccio
- Domenico Ventura
- Ed Schepis
- Fabrizio Gianneschi
- Filippo Diotalevi
- JavaJournal.it Blog
- Luca Grulla
- Luigi Zanderighi
- Marcello Teodori
- Mida Boghetich
- Muralidharan Chandrasekaran
- Piero Ricca
- Renzo Borgatti
- Simone Bordet
- Uberto Barbini
- Valvolog
- Webtide blogs (Greg Wilkins & Jan Bartel)
Links








You can fix the ps -ef (illegal option) problem by ensuring that the environment variable COMMAND_MODE is set to unix2003
I have found that launching ps via iTerm would exhibit the problem but not when run via Terminal.app.
Set the environment variable in your bashrc or profile (or better yet, in the system-wide version in /etc).
I can’t help you with the man page inconsistencies, although it may be that the man pages are documenting the unix2003 behaviour, and all might be consistent when you try running those commands again with unix2003
Hope that helps.
Thanks James!