Two answers:
(1) Distribution theory. On the space $\mathcal D'(\mathbb R)$ of continuous linear forms on $\mathcal D(\mathbb R)=C_c^\infty(\mathbb R)$
it is easy to define the first derivative:
$$
\left\langle\frac{du}{dx},\phi\right\rangle_{\mathcal D'(\mathbb R),\mathcal D(\mathbb R)}=
-\left\langle u,\frac{d\phi}{dx}\right\rangle_{\mathcal D'(\mathbb R),\mathcal D(\mathbb R)}.
$$
You get the ordinary derivative of a differentiable function,
also $H'=\delta$ ($H$ is the Heaviside function, characteristic function of $\mathbb R_+$, $\delta$ the Dirac mass),
$$
\frac{d}{dx}(\ln \vert x\vert)=\operatorname{pv}\frac{1}{x}
$$
and many other classical formulas. In particular, you can define the derivative of any $L^1_\text{loc}
$
function, of course not pointwise but as above.

(2) Operator theory. In $L^2(\mathbb R)$, you consider the subspace
$H^1(\mathbb R)=\{u\in L^2(\mathbb R), u'\in L^2(\mathbb R)\}$, where the derivative is taken in the distribution sense.
Then the operator $d/dx$ is an unbounded operator with domain $H^1(\mathbb R)$. It is even possible to prove that the operator
$\frac{d}{i\,dx}$ is selfadjoint.