  For two graphs $J$ and $H$, the generalized Tur\'{a}n number, denoted by
$ex(n,J,H)$, is the maximum number of copies of $J$ in an $H$-free graph of
order $n$. A linear forest $F$ is the disjoint union of paths. In this paper,
we determine the number $ex(n,S_r,F)$ when $n$ is large enough and characterize
the extremal graphs attaining $ex(n,S_r,F)$, which generalizes the results on
$ex(n, S_r, P_k)$, $ex(n,K_2,(k+1) P_2)$ and $ex(n,K^*_{1,r},(k+1) P_2)$.
Finally, we pose the problem whether the extremal graph for $ex(n,J,F)$ is
isomorphic to that for $ex(n,S_r,F)$, where $J$ is any graph such that the
number of $J$'s in any graph $G$ does not decrease by shifting operation on
$G$.
