You could use the
rename command like this:
$ rename -n 's/MOD11A1\.A2010(...)\..*/modis$1.hdf/' MOD*.hdf
After testing, remove
-n to actually rename files.
... three characters that could be anything
(some chars) save
some chars to reference later with
- We could use a simple regex to match the first part of the filename in the
rename command, as muru's answer does. Sometimes you want to use a more explicit expression to distinguish between files that you do or don't want to act on, or to be sure that your regex won't suck up too many characters. There's usually a lot of flexibility in solving this kind of problem.
Note that this doesn't give you exactly what you asked for; it maintains the fixed width of the numbers. I have done this because it's a good idea to use fixed-width numbers in filenames (otherwise they will be sorted in a confusing way, with 10 before 2, for example) (and
because I haven't figured out how to use muru's answer does that...).
rename to create the names you actually asked for... if I do, I will update my answer
Note that Perl
rename is not included in the default 17.10 installation, so if you are running 17.10 (or for future readers, perhaps a later version), start by running
sudo apt install rename