Search

Friday 22 January 2010

Linux - Run multiple commands together

Just create your script or from command line put && between commands. This logical operator 'and' will run the first command, then if successful will run the second. If the first fails the command chain will stop. i.e.

./configure && make && make install

The other logical operator available is || this means 'or' for example, run a script and if it fails print a warning, i.e.

./some_script || echo "The script isn't working!"

Linux - export system info

Just open up a terminal and do the following:

uname -a >system.txt
lspci >>system.txt
lspci -vv >>system.txt

Tuesday 5 January 2010

Convert AAC or M4A to MP3 format

Seeing as I don't like Apple much, I had some music that needed converting. My old friend Linux Mint was used again.
  • Just fire up Synaptic and add the Lame and FAAD packages
  • Create a new shell script with the following text:
#!/bin/bash
for i in *.m4a; do
echo "Converting: ${i%.m4a}.mp3"
faad -o - "$i" | lame - "${i%.m4a}.mp3"
done

  • save the script as mp42mp3
  • copy the file to the /bin/ folder and make it executable (you will need to sudo)
  • Open a terminal window in the folder you wish to convert M4A's and type m4a2mp3 and the script will convert all the files to MP3