Generally you order them to be the next size beyond the actual travel. e.g. Linear sensors I have ordered include a 500mm long to cover 480mm of real travel. That leaves only 20mm each side spare, which is just over 3/4".
The actual physical length of these is about 140mm or so , say 5.5 inches longer than the real travel.
Yes - you can shorten them, and there is a YouTube video which shows exactly how. You have to disassemble them, and cut the metal casing to be shorter, then put the plastic bits from the end onto the shorter assembly. The etched glass sensor grating have to be shortened as well. The common method seems to be to gently grind across with a Dremel-type diamond thin disc thing , on both sides, and then gently clamping the main part between card, and breaking the unwanted piece off.
-->
Cutting a glass scale for a DRO
There are others ..
DRO Scales - Making them Shorter
How to Cut (Shorten) Glass DRO scales
Take your pick