November 20, 2008, Thursday, 324

Computers/Linux

From Alexander Krivács Schrøder.NET

Jump to: navigation, search

Contents

Useful tools/commands

I keep finding lots of useful things to do on Linux, but I also keep losing track of them. Therefore, I will keep a list of the useful things I find here, so I can return to them easily later.

Mass renaming

If you want to rename all .php3 to .php, this is how you do it:

ls -d *.php3 | sed 's/\(.*\).php3$/mv "&" "\1.php"/' | sh

Convert all WAV files in folder to MP3 or vice versa

for file in *.wav; do lame "$file" "${file%.*}.mp3"; done
for file in *.mp3; do lame --decode "$file" "${file%.*}.wav"; done

Rip a website

wget --random-wait --retry-connrefused -nH -r -l inf -p -np http://example.com/

If you only want to rip certain elements, say the pictures from a site, you can add an '-A' to the command, like so:

wget --random-wait --retry-connrefused -nH -r -l inf -p -np http://example.com/ -A jpg,jpeg
This page was last modified 09:56, 23 December 2007.