Tough thing about headphones is I find they're only comfortable for so long. That, and there are times where I can't really work with music and just need quiet.
As for noise, I don't work in an office (mostly at home), but if I need to cut out the noise but don't want music I still will put on my headphones. If I really need to cut out the world, some white noise will do the trick.
Sox is well documented but here is the command I use for 90 minutes of brown noise (I try to get up and walk for a minute each time it finishes).
play -n synth 90:00 brownnoise brownnoise