It applies only when it is on the battlefield. Generally speaking, unless an ability on a card specifically refers to functioning elsewhere, it only works while it is on the battlefield, i.e. as a permanent. The commanders from a couple years ago, such as The Ur-Dragon, are exceptions