Do you mean rugs made of carpet or the protectors (druggets)?
If the former then in the past I've seen the backs fitted with a patch of hooks on each corner that help to some degree but then they will of course damage the carpet.
If the latter then most aircraft have metal loops at the floor/wall corner for hooks on the Drugget to loop in to.