rename and shorten many files with bash

Reading Time: < 1 minute

Bash supports a surprising number of string manipulation functions.

For example if you want to get rid of the beginning of the name of a file or a folder on many files at a time you could do the following:

 
bash> ls
mylongfile1
mylongfile2
mylongfile3
mylongfile4
mylongfile5
mylongfile6
mylongfile7
 
bash> for i in *
> do
> mv $i ${i:6}
> done
bash> ls
file1
file2
file3
file4
file5
file6
file7
So to extract the end of a variable after a NUMBER of characters you just need to specify ${variable:NUMBER}
 

How to remove a Compeed from a sock

Reading Time: < 1 minuteCompeeds have saved my life numerous times already. Some people can’t stand them, I am a strong believer and I cannot go running, play rugby, or go for a long hike without having one in my pocket.

 
They are so good that you can actually recover almost instantly from a blister. If there is blister forming under your foot, that’s where Compeed is the best, when the blister is not there yet but you know that if you go on for another 10 minutes it will turn into a blister.