Right Click to Ignore All But Terrain, How?

I have an RTS where the left mouse button is used for ID and information sorts of things and the right mouse button is used exclusively for movement (move to click point). I have no problems with controlling the left button by ignoring certain colliders etc. But I often need the right mouse button to ignore everything except the terrain so I can move objects to locations that is covered by other items. I’m currently looking at “layers” in the manual Unity - Manual: Layer-based collision detection.
It’s a bit confusing though.
I don’t need anyone to do my work for me but is there some other place(s) I can look that might assist me with my problem.

Just give all your terrain a “terrain” tag and in your right click code add something like… i’m not at my computer so I’m not going to write actual code but anyway, something like…

If Button click right button
Do raycast
If raycast hit != null then
Only hit thing with terrain tag so do stuff

Ya, thanks. Sounds like it will work. I’ll try it here soon and if it works I’ll “accept” your answer. I appreciate that you took the time to help me. I tried some stuff with “layers” but I couldn’t get it to work. But, I didn’t do it the way you suggest in your answer but it sure sounds like it will work. Thank you kindly for taking the time to help me.