diff(f(g(x)),x,1)



Alternatively, you can use the positional derivative package (pdiff).

 (%i1) load(pdiff)$

Here g[(n)] is the n-th derivative of g (a function of one variable).

 (%i2) diff(f(g(x)),x);
 (%o2) g[(1)](x)*f[(1)](g(x))

 (%i3) diff(f(g(x)),x,2);
 (%o3) g[(1)](x)^2*f[(2)](g(x))+g[(2)](x)*f[(1)](g(x))

And f[(m,n)] is the m-the derivative with respect to the first variable
and the n-the derivative with respect to the second:

 (%i4) diff(f(x,y),y);
 (%o4) f[(0,1)](x,y)

 (%i6) diff(f(x,x^2),x);
 (%o6) f[(1,0)](x,x^2)+2*x*f[(0,1)](x,x^2) 

--Barton