Shear flows play critical roles in biological systems and technological applications and are achieved experimentally using moving parts. However, when the system size is reduced to micro- and nanoscale, fabrication of moving parts becomes exceedingly challenging. We demonstrate that a heterogeneous nanochannel composed of two parallel walls with different wetting behaviors can generate shear flow without moving parts. Molecular dynamics simulations show that shear flows can be formed inside such a nanochannel under a temperature gradient. The physical origin is that thermo-osmosis velocities with different rates and directions can be tuned by wetting behaviors. Our analysis reveals that thermo-osmosis is governed by surface excess enthalpy and nanoscale interfacial hydrodynamics. This finding provides an efficient method of generating controllable shear flows at micro- and nanoscale confinement. It also demonstrates the feasibility of using fluids to drive micromechanical elements via shear torques generated by harvesting energy from temperature differences.