Posts Tagged ‘ bash ’

Search and replace text in many files

January 6, 2012
By

This is a handy one liner that searches and replaces text in multiple files. (You can use find for example to run it in multiple folders) View Code BASH1 perl -pi -e 's/old_text/new_text/g' *.conf This line replaces old_text with new_text in all the .conf files in the current folder. Of course you can use...

Read more »

flac2mp3 conversion bash script

December 13, 2011
By

I recently started buying some music in flac format. Though I’m content on storing it as flac on my NAS I don’t like filling up my phone’s memory and also I have the impression that listening to flac uses more battery on my n900. So I devised a small script that converts all the...

Read more »

My fortune command line…

October 15, 2011
By

I take my bash profile very seriously I use: # fortune fortunes fortunes-o fortunes2 forunes2-o 30% startrek The above means to choose fortunes only from the 5 specified files and more it assures that I get startrek fortunes from time to time. Note that because lists are not equal in size it doesnt mean...

Read more »

Automatically sync photos from digikam to your mobile phone

June 22, 2011
By
digikam_logo

I shoot a lot of pictures. My collection keeps growing (for example ~90 Gb right now) and since last year I discovered the joy of using digikam to tag and organize them. I’m using the beta 2.0.0 version and use mysql to store it’s databases (as opposed to the default sqlite) as it’s easier...

Read more »

Force fsck on next reboot

July 19, 2010
By
fsck

Let’s say you run a headless server and you want to fsck the main partition. The easy solution in this case is (if possible) to force fsck to run on the next boot. If you run slackware than all you really need is to create an empty file in /etc called forcefsck You could...

Read more »

Easily send mail from a bash script

March 18, 2010
By

Did you ever need to have e-mail's sent from within a bash script? Maybe alert you of errors encountered? Me too. Here's an easy way on how to do it:

Read more »

Rename all files in a folder from upper to lower case.

February 12, 2010
By

Sometimes is needed to have all files in a folder in the same case. Here’s a small script to rename all files in the folder to lower case: View Code BASH1 for i in *; do mv $i `echo $i | tr [:upper:] [:lower:]`; done

Read more »

Checking directory sizes from the BASH prompt

January 18, 2010
By
bash_script

The command ls can be made to show directories and permission but it will not display directory sizes. Then it’s time for other commands. For example on my hosting account there is no file manager installed and evidently x and kde is missing too so, to find out directory sizes I can use the...

Read more »

Follow Me

Subscribe via RSS