linux
Download and convert YouTube FLV flash video to MPG/AVI
If you’re interested in converting FLV flash videos into more common and portable formats, this is for you. For whatever reason, I couldn’t get ffmpegX (Mac OS X GUI for ffmpeg) to convert an FLV because it would fail with a bunch of errors.
Convert .FLV files into MPEG:
ffmpeg -i flashvideo.flv -ab 64 -ar 22050 -b 800 -s 320x240 video.mpg
You can tweak the switches (i.e. -ab, -ar, -b, -s) to optimize the file size that gets produced. Lower numbers create smaller files but less quality.
I only use the MPEG way method because I haven’t figured out how to install xVid or DivX codecs onto my Mac machine.
Reference How to download and convert YouTube video to MPG/AVI in Ubuntu?
Pipe ls to wc to get file count in your directory
ls does not give you a file count. To get a file count you can pipe ls into the wc command. I guess wc means “word count”.
ls | wc -l
Get past "argument list too long" using xargs
Recently I kept geting “Argument list too long” error while trying to delete about 12,000 files from a directory. It was simply too much for rm * to handle.
[mycomputer:~ bob$ rm *
bash: /bin/mv: Argument list too long
To get around this you do this:
ls | xargs rm
That will pipe the ls output as an argument to rm until everything is gone. Very excellent. This will work with other shell commands as well.
