Archive for the Category » Linux Scripts «

Sunday, May 16th, 2010 | Author: muthii

Do a back up a recoverable system backup or a backup for all important docs you have on system before you proceed with the commands below

yum clean all
yum update glibc\*
yum update yum\* rpm\* python\*
yum clean all
yum update
reboot

Check  your  new version with :

lsb_release  -a

Category: Linux, Linux Scripts  | Tags:  | Leave a Comment
Sunday, May 16th, 2010 | Author: muthii

I had installed ipupdate while trying out dnsexit.com and loved its simplicity, dnsexit.com provides a great service but in the end I chose to stick with my current registrar lqconsulting who is a major supporter of Linux users, they also run linuxquestions.org of which am a member. I had tried to configure ddclient to work with my registrar but I did not have enough info about my registrar’s requirements of the client to work with their site. So in the mean time I have edited ipupdate to send me an email everytime my ip address changes while still doing evrything else it does. I prefer it this way over updating my registrar, since I do a lot of remoting in and it takes a few minutes before a new IP is updated to nameservers “around 20min”, but if I already have my new IP in my mail when it changes I don’t have to wait until nameservers update my site IP for me to be able to remote in. I have provided the edited file below for anyone who wants to use it also the tar,rpm and deb files that install it.

For install instructions go to:

My edited file
You can replace the installations ipupdate.pl with mine for v1.6-2 or just copy over my additions to them whichever works for you.

Wednesday, August 19th, 2009 | Author: muthii

I found this neat cmd to use when trying to find files larger than certain sizes e.g

find / -type f -size +200M

If you want files less than that size you can do

find / -type f -size -200M

For other ways to use the cmd check out this post where i got the info from.

This other cmd finds files larger than 10M and calculates their sizes too.

find / -size +10240000c -exec du -h {} \;

Remember in all cases to change “/” to the location you want to search for the files e.g “/home/username”.

Monday, August 10th, 2009 | Author: muthii

For a single file:

ffmpeg -i -acodec libmp3lame -ar 22050

For a bunch of M4B files:

for m4b in $(ls -1 *.m4b); do ffmpeg -i $m4b -acodec libmp3lame -ar 22050 ${m4b}.mp3; done
Monday, August 10th, 2009 | Author: muthii

Removing spaces from filelemanes can be archived using various methods. The command below uses sed to do this, before running it make sure you are in the folder containing the files whose names you want to change.

for file in *; do mv "$file" `echo $file | sed -e 's/  */_/g' -e 's/_-_/-/g'`; done
Monday, June 01st, 2009 | Author: muthii

Command to delete files older than x days

find /your_directory -mtime +7 -exec rm -f {} \;

works great for my mysql backup folder.

Monday, June 01st, 2009 | Author: muthii

Had a few wma’s I needed to convert to a different format as I was having trouble streaming them over the net with my internet jukebox. I decided to go with ogg since I don’t have a decent hardware setup, GUI converters did not give me the best output. I tried both oggconvert and soundconverter both are great apps, but my hardware didn’t do them justice, but the command line came to my rescue. To convert the wma’s to ogg I used this cmd

find -name '*wma' -exec ffmpeg -i {} -acodec vorbis -ab 128k {}.ogg \;

This will convert all wma’s in the folder and subdirectories to ogg and you don’t have to take out empty spaces in the file names, it handles them ok.
All the new files have a name “track name.wma.ogg” to rename them to “track name.ogg” I was given this handy scripts by my friends at LinuxQuestions.org.

for file in *.wma.ogg; do mv "${file}" "${file%.wma.ogg}.ogg"; done

and

for file in *.wma.ogg; do mv "${file}" "${file/.wma.ogg/.ogg}"; done

This last one is a more general solution that keeps the first part, and the last part, regardless of the extensions used

for file in *.wma.ogg; do mv "${file}" "${file%%.*}.${file##*.}"; done

just change your variable to suit whatever you are working with.