It all works in Linux, which means most of it will work in Apple systems. Microsoft is working on a complete terminal emulator for Windows that actually works - good for them.
some command file.txtends up looking like
for f in *.*; do some command "$f"; doneIn which some command is executed for all files in the directory. "$f" means the filename (without extension). *.* refers to the files in the directory; you can replace the asterisks with strings to be more precise (*.txt to target only text files, et cetera).
rename 's/foo/bar/g' *This is just the intended use of rename; however, forumdwellers will often give such convoluted ways of doing something that can be done with rename that I think it's useful to give this example.
Remember to \escape symbols like ., # or !. To preview the result without renaming, add -n directly after rename. When you're happy with the result, remove the -n and execute.
rename 's/^0*//' *.jpg
oldname1.ext newname1.extEt cetera. the filenames are separated by spaces and must include the extensions. If you have filenames with spaces in them, place the entire filename in "quotes". Place the file in your working directory and run this line of code:
while read line; do eval mv $line; done < rename.txtIt simply appends mv to the start of each line, and then runs them.
head -n1 *.txt > newfile.txt
for f in *.txt
sed -i -e "s/foo/$namex/g" $name
sed -n -i '/foo/p' file.txt
for f in *.*; do ffmpeg -i "$f" -vf scale=640:ih*640/iw -vcodec libvpx -b:v 0.4M -acodec libvorbis -qscale:a 5 oot/"$f".webm; doneI've found that these settings are good for web video (see here): small files with decent resolution and audio. You can experiment with them to see what suits you best, of course.
This example converts in.pdf to out.pdf, compressing its embedded images to what it considers 'ebook' levels; decent but not beautiful.
gs -sDEVICE=pdfwrite -dNOPAUSE -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dBATCH -sOutputFile=out.pdf in.pdfThe controls aren't terribly fine-grained, but it's good enough for most purposes. Other options for the -DPDFSETTINGS flag are /screen (shit), /printer (a bit better than ebook), /prepress (nice) and /default (the best). GhostScript is great, but its flags' freaky capitalisation is a fucking nightmare.