We aim to construct a general framework for portfolio management in continuous time, encompassing both stocks and bonds. In these lecture notes we give an overview of the state of the art of optimal bond portfolios and we re-visit main results and mathematical constructions introduced in our previous publications (Ann. Appl. Probab. \textbf{15}, 1260--1305 (2005) and Fin. Stoch. {\bf9}, 429--452 (2005)). A solution of the optimal bond portfolio problem is given for general utility functions and volatility operator processes, provided that the market price of risk process has certain Malliavin differentiability properties or is finite dimensional. The text is essentially self-contained.