Change multiple file formats with a single line.

I have a bunch of output files from my calculations (*.AVATRANS) and I want to simply change their format to (*.dat) to be able to plot them later.

Simply open the terminal, go to the folder with the output files in and type:

find -type f -name ‘*.AVATRANS’ -printo |xargs -0 rename ‘s/.AVATRANS$/.dat/’


Your know a better way, please share it in the comments.

Smile!

Note: -print0 (zero not O)

 

How many processors do I have? Linux-style

I have 6 computers in the lab to work with. Two of them have different number of processors. Whenever I need to mention the number of processors in an input file for parallel computing, I usually have a hard time remembering which two were the less well-endowed!?! There is an one-liner that helps me finding how many processors I have:

Open the terminal (ctrl+Alt+T) and type:

grep -c processor /proc/cpuinfo

(what it does is merely counting the number of times there is the word cpu in your cpuinfo file.) To me this is the simplest way of getting this job done!

Smile 🙂