Abstract This paper presents results obtained from a numerical simulation of a two-dimensional (2-D) incompressible linear shear flow over a square cylinder. Numerical simulations are performed, using the lattice Boltzmann method, in the ranges of 50⩽Re⩽200 and 0⩽K⩽0.5, where Re and K are the Reynolds number and the shear rate, respectively. The effect of the shear rate on the frequency of vortex shedding from the cylinder, and the lift and drag forces exerted on the cylinder are quantified together with the flow patterns around the cylinder. The present results show that vortex structure behind the cylinder is strongly dependant on both the shear rate and Reynolds number. When Re=50, a small K can disturb the steady state and cause an alternative vortex shedding with uneven intensity. In contrast, a large value of K will suppress the vortex shedding from the cylinder. When Re>50, the differences in the strength and size of vortices shed from the upper and lower sides of the cylinder become more pronounced as K increases. Vortex shedding disappears when K is larger than a critical value, which depends on Re. The flow patterns around the cylinder for different Re tend towards self-similarity with increasing K. The lift and drag forces exerted on the cylinder, in general, decrease with increasing K. Unlike a shear flow past a circular cylinder, the vortex shedding frequency past a square cylinder decreases with increasing the shear rate. A significant reduction of the drag force occurs in the range 0.15