Make “ps -ef” work in a shell on Mac OS X

If you’re used to SunOS or BSD, you’ll be at home with Mac OS X’s “ps -aux” to get a process list from a shell prompt.

If you’ve been using any other recent unix, though, your fingers will want to type ps -ef instead. Rather than hack an alias to wrap ps to make this happen, it turns out there’s an easy way to return to the ps promised lands.

By default on Mac OS X 10.5.2, the shell environment’s COMMAND_MODE is set to legacy. If you set it to unix2003, you’ll get your ps -ef. Just add

export COMMAND_MODE=unix2003
alias zcat='gunzip -c'

to your ~/.bashrc to make it be set automatically.

The alias of zcat to gunzip -c fixes a “feature” in unix2003 mode — it removes gzip support from zcat. If you’re used to using zcat for both compressed .Z files as well as gzipped .gz files, you want the alias line as a workaround.

Related posts:

  1. HOWTO: Make system-wide RVM installations work with cron, monit, delayed_job, and passenger
    System-wide RVM installations are recommended for production deployments, but because /usr/bin/ruby is no longer the “correct” ruby, you need to tell all your moving parts about RVM. Before installing ruby......
  2. Make OpenOffice the default “.doc” and “.xls” application on Mac OS X
    OpenOffice 3.0 is now out for the Mac. Finder opens files that end in “.doc” with TextEdit by default, and “Open with…” doesn’t seem to stick. What to do? In......
  3. Set up JAVA_HOME to track Java Preferences.app on Mac OS X
    Mac OS X’s Java Preferences.app has a pane for switching between versions of the JDK, but I just found out from a coworker (thanks, Mike!) that you can make your......
  4. HOWTO: simulate the cron environment
    While banging my head on RVM + Rails 3 + crontabs, it became clear that I needed the cron environment in an interactive shell. It’s not hard: sudo su env......