Answer
$$ y= x -1+Ce^{-x}$$
Work Step by Step
Given $$y^{\prime}=x-y$$
Since the equation is linear and $p(x)= 1$ and $q(x)= x$, then
\begin{align*}
\mu &=e^{\int p(x)}dx\\
&= e^{\int dx}\\
&=e^{x}
\end{align*}
Hence the general solution given by
\begin{align*}
\mu(x)y&=\int \mu(x)q(x)dx\\
e^{x}y&= \int xe^{x}dx\ \ \ \ \text{integrate by parts }\\
&= xe^x-e^x+C
\end{align*}
Then
$$ y= x -1+Ce^{-x}$$