ls *.txt |awk '{print "mv "$1" " substr($1,1,(index($1,".txt")))"csv"}' |sh

**Command explanation:**

`ls *.txt` lists files ending with txt

`| awk '{print "mv "$1" " substr($1,1,(index($1,".txt")))"csv"}` prints the command that allows to rename the previous files listed with txt to csv

`| sh` executes the previously printed command, thus effectively renaming the files

**Note:** if you want to list all files including hidden files (those starting with `.`) use `ls -a *.txt` instead