Rough day in court because the judge threw the book at you? “The book” in this idiom refers to the full list of applicable laws, that is, the all the laws you broke and penalties you’re facing.
Have a great reason why you’re innocent, like being far from the crime scene at the time in question? That’s your alibi, which is Latin for “elsewhere.”
Aspiring attorneys take the bar exam, hope to join the local bar, then get disbarred if they’re too naughty. All this bar business goes back to Middle Ages England, where a physical barrier in the courtroom (often an actual bar) separated attorneys authorized to argue cases before a judge from spectators and others. Hence, the English “barrister” was one who had been “called to the bar” and had this courtroom role. To this day, many courts still keep some separation (think of that little gate) between spectators and the seating places for the judge, jurors, attorneys, witnesses, and courtroom personnel.
When the tradition of judges wearing robes jumped the Atlantic from England to the US, early American judges opted for black robes instead of the colorful ones their British counterparts were wearing, and also ditched the tradition of wearing white powdered wigs. As US Supreme Court justice Sandra Day O’Connor has noted, however, the wearing of simple black robes continues only through tradition, as there are no formal rules or laws governing justices’ apparel. Judges and justices down the centuries have kept with the tradition, with some hints of flair, and most recently the legendary US Supreme Court justice Ruth Bader Ginsburg used the collar she wore over her robe to signal her opinion in certain cases.
Another piece of American judicial tradition far predates the country itself, as every day of arguments of the US Supreme Court begins with the court marshal calling out “Oyez! Oyez! Oyez! All persons having business before the Honorable, the Supreme Court of the United States, are now admonished to draw near and give their attention, for the Court is now sitting. God save the United States and this Honorable Court!” Pronounced “oh yay,” this term goes back to 13th century old French “oiez” and translates to “hear ye / hear this / listen up.” Modern Spanish speakers make the same sound and meaning when they say “oye.”
The terms “attorney” and “lawyer” are often used interchangeably in the US, but they are technically different. A lawyer has a law degree, but is not necessarily licensed to practice law in court. An attorney has a law degree, has passed the bar exam and is licensed to practice in at least one jurisdiction. Hence, all attorneys are lawyers, but not all lawyers are attorneys.
Dramatic courtroom gavel-banging is now more a product of Hollywood than reality, as most modern judges rarely, if ever, use them. However, courtroom gavels are a curiously American invention. The most likely lineage for this tradition is from the symbolism-heavy Freemasons’ use of this stoneworking tool in ceremonies. From there it likely came in the US Senate, where a handle-less ivory model is still banged a lot, and from there to American courtrooms. You won’t find these (and never could) in the courtrooms of England or any other countries which inherited English law.