Pgrep is also available via brew, which is syntactically closer to ps, but less efficient than psgrep: ![]() This option only includes the running user's processes. b Search the process list using BSD's "ps ux" format (default). Includes all users' processes in the search. a Search the process list using BSD's "ps aux" format. That said, you can still use psgrep to behave as OS X’s ps would. (as obtained by ps(1) ) using the awesome utility grep(1) for its power. Psgrep is a small Bash shell script that searches the process list The best alternative formula available via Homebrew is psgrep: As to why there is no builtin ps in GNU’s coreutils package, see this answer on the Unix & Linux Forums. If there is a specific feature missing from the OSX ps, you'll have to find another program that can do it, or write one yourself (look at the sysctl manual, in particular KERN_PROC as a starting point), or modify the existing ps command to add the feature.Īlternately, if you can get what you need by parsing the output of the ps command itself, you may be able to write a portable program - the output with the -o option is reasonably reliable across platforms, particularly if you refer to the UNIX standard for the column names to use. In general there is no standard for how process information is available to programs like ps and top so the program has to be designed for a specific operating system. Other systems may use either mechanism but provide data in a different format, or may require programs like ps to read directly from the kernel's memory. ![]() Linux uses a pseudo-filesystem in /proc, whereas OSX uses the sysctl function. ![]() The reason why this cannot be ported to OSX is because Linux and OSX kernels do not expose this information in the same way. The ps command available on linux is, as others have mentioned, from the "procps" package.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |