Category Archives: CentOS

How to rename multiple files in Linux

The following bash script renames all the files matching src_name.* with dst_name.*:

src_name=$1
dst_name=$2
unset $1
cp $src_name.* ~/temp/
cd ~/temp/
rename "s/$src_name\.([a-z]+)/$dst_name\.\$1/" *
cd -
mv ~/temp/$dst_name.* .

If you have some files like src1.h and src1.cpp, you can save this script into dupsource.sh file, for example, and then rename those files with src2.h and src2.cpp using the following command:

dupsource.sh src1 src2

The script requires ~/temp directory to exist and be writable.

What packages QAudioDecoder may require on Ubuntu and CentOS?

If QAudioDecoder does not decode mp3, reporting a format error (GStreamer; Unable to start decoding process), the following package can help:
On Ubuntu:

apt-get install gstreamer0.10-fluendo-mp3

On CentOS:

yum -y install http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
yum install gstreamer{,1}-plugins-ugly

(more…)