Arrange icon position via terminal

Is there a way to arrange icons from terminal?
Was thinking to make a bash scripts as sometimes(quite seldom) my icons just rearrange on their own and it's damn annoying having to drag them to the place they were.