How can I sort du -h output by size

As of GNU coreutils 7.5 released in August 2009, sort allows a -h parameter, which allows numeric suffixes of the kind produced by du -h: du -hs * | sort -h If you are using a sort that does not support -h, you can install GNU Coreutils. E.g. on an older Mac OS X: brew … Read more

Passing additional variables from command line to make

You have several options to set up variables from outside your makefile: From environment – each environment variable is transformed into a makefile variable with the same name and value. You may also want to set -e option (aka –environments-override) on, and your environment variables will override assignments made into makefile (unless these assignments themselves … Read more

Compiling a C++ program with gcc

gcc can actually compile c++ code just fine. The errors you received are linker errors, not compiler errors. Odds are that if you change the compilation line to be this: which makes it link to the standard c++ library, then it will work just fine. However, you should just make your life easier and use g++. EDIT: … Read more

grep –ignore-case –only

This is a known bug on the initial 2.5.1, and has been fixed in early 2007 (Redhat 2.5.1-5) according to the bug reports. Unfortunately Apple is still using 2.5.1 even on Mac OS X 10.7.2. You could get a newer version via Homebrew (3.0) or MacPorts (2.26) or fink (3.0-1). Edit: Apparently it has been fixed on OS X 10.11 (or maybe earlier), even … Read more