Bash renaming in sequential numbers

use a loop, let, and printf for the padding:
a=1
for i in *.jpg; do
  new=$(printf "%04d.jpg" "$a") #04 pad to length of 4
  mv -- "$i" "$new"
  let a=a+1
done
Use %d.jpg for no padding.
Source: http://stackoverflow.com/questions/3211595/renaming-files-in-a-folder-to-sequential-numbers