Examples of restricted line officers include: supply officers, medical officers, nurses, civil engineering duty officers, intelligence officers.
Medical officers, chaplains, civil engineers, supply officers and lawyers are staff corps officers. "Restricted line" are basically specialized officers who cannot command like line officers, but don't fit into an established staff corps: Engineering duty only, public affairs, intelligence, meteorology, crypto, HR etc. Navy lawyers used to be restricted line until 1967 when the JAG Corps was established.
As an addendum to my post above this one, it IS possible in the Navy for restricted line officers to command shore installations. A buddy of mine (an O-6 supply officer) just came back from being the commanding officer of naval supply activities in Yokosuka, Japan. But commanding a shore-based supply installation is about the limit of his command authority- if he was visiting a carrier at sea and something wiped out every O-6 on board except him, he would still not be allowed to take command because he is not in the unrestricted line of command.
And of course Civil Engineer Corps officers command Seabee units. That was the first exception granted to the "only line officers can command" policy back in WW2, and the first and only four-star staff corps admiral was a CEC officer.
But, yeah, none of that really applies to Star Trek most of the time. One thing I liked in TOS was when the almost-unknown Lt. De Salle took command, apparently just because he was the next senior officer.