Officer of the line
An officer of the line, or line officer, was an officer that was part of the normal command structure and who could exercise general command authority. Unlike a chief engineer, a chief medical officer was not typically considered an officer of the line.
When Commander Montgomery Scott was in command of the USS Enterprise while Captain James T. Kirk and Commander Spock were being held hostage on Eminiar VII in 2267, Doctor Leonard McCoy expressed frustration with a lack of communication from the surface, Scott asked McCoy what he suggested they do, prompting McCoy to reply, "Me? I'm a doctor. If I were an officer of the line, I'd..." but Scott cut in, stating, "Would you have me open fire?" Leaving McCoy to answer, "Of course not." (TOS: "A Taste of Armageddon") Earlier that year, Spock had presented himself to Dr. McCoy for arrest due to his being the senior officer present at that moment. (TOS: "The Menagerie, Part I")
Prior to the arrival of the USS Enterprise at Farpoint Station, and their official transfer to their new ship, Commander William T. Riker shared his interest with Commander Beverly Crusher in the odd happenings that he had observed there. While Crusher felt that "there are reasons for a first officer to want to demonstrate his energy and alertness to a new captain," she began to indicate otherwise, stating that her "duty and interests [were] outside the command structure..." before the pattern on the bolt of fabric she was looking at changed, adding to the list of odd happenings Riker spoke of. (TNG: "Encounter at Farpoint")
Appendices
Background information
Bajoran line officer ranks
The Star Trek Encyclopedia, 2nd ed., p. 29, used the name 'line officers' to display the ranks of the Bajoran Militia; namely major, captain, lieutenant, lieutenant (j.g.), and ensign.