Use the pattern removal functionality described in D3. The following `for' loop will do the trick: for f in *.foo; do mv $f ${f%foo}bar done