Navy restricted line officers have stars on their service dress uniform sleeves. Star = Line (URL or RL). (do not mix up any stars on sleeve with stars on collars, which signify rank and another ballgame entirely)
They are usually indistinguishable from unrestricted line counterparts, since many of the RL officers have earned a warfare designation pin and then laterally transferred to RL. As noted before in other threads, URL officers are eligible to command at sea. RL officers may command ashore at commands in their restricted community.
Staff officers, such as Supply, Medical, Nurse, Medical Staff, Chaplain, JAG and other "corps" officers do not wear stars on their service dress uniform sleeves but the insignia of their corps.
There are flag officers (admirals) in ALL of the RL and Staff corps communities, and plenty of O-6's, just not as many, because the size of the RL and Staff communities is much smaller than unrestricted line communities (aviation, submarine, surface are the biggest). And, just one RL officer, say, the Oceanographic officer, might be assigned to a carrier or large shore command. You won't have whole clusters of RL officers at any one command, unless it's their own command, such as a METOC (meterological center) or similar command for other RL communities.
NOT true "they can't rise above O-5." You just don't see 'em out and about as much, especially the Intell and Crypto types who work in the buildings with no windows and have clearances "beyond black." Bless 'em, they can't tell us what they do but it's critical to national security.
Thanks Captain, from an enlisted Marine.