how to rename file sequential in ubuntu

how to rename file sequential in ubuntu

ls -v | cat -n | while read n f; do mv -n "$f" "$n.ext"; done 

Source: stackoverflow.com