On Debian, Ubuntu and derivatives, if you enter man rename at a command prompt, you'll get the manual page for a rename utility that allows arbitrary Perl-like regular expression commands to be used in the renaming.
For example, this will shorten (by truncating) all files in the current directory to a length of five:
rename 's/^(.{5}).*/$1/' *
It works by capturing the first five characters then using that in the substitution, removing the rest.
Another example is to shorten filenames (sans extension) to five characters wile preserving the extension:
rename 's/^(.{5}).*(\..*)$/$1$2/' *
It captures two groups, the first being the first five character, the second being the extension. This would turn myCarefullyCraftedDocument.pdf into myCar.pdf.
Warning: Use this carefully, preferably on a copy of your directory, or by taking backups first. You have been warned!! At a bare minimum, use rename -n first, which will show you what would be done without actually doing it.