Bash bits

Search and replace text in a whole bunch of files

sed -i “s/cpelc.htm/blech.html/g” *.htm (easy when you know how)

Create data DVD with normal filenames

growisofs -Z /dev/dvd -dry-run -R -J -iso-level 2 *

That will stop it renaming everything to 8char names!

Remote diff

ssh remotehost ‘cat remotefile’ | diff - localfile

Makes sense really.

Get totem to play and add to the playlist all avi files below this point in the directory tree:

find . -name '*.avi' -exec totem –enqueue {} +

(same could be done with mp3 or whatever also)

Hard disk temp:

sudo hddtemp /dev/sda

CPU temp:

cat /proc/acpi/thermal_zone/THM0/temperature

(try and keep cpu below 70!)

Useful features of find!

find -perm 664 -name '*.php' -exec ls {} \; > /tmp/664_files.txt

Read and operate on lines of a file:

cat file.lst | while read line; do echo “${line}”; done

Rsync to reliably find different files/dirs between two places

rsync -e ssh -avzc –dry-run –exclude=“html/usage/” –exclude=“logs/” /var/www/marinesoutheast/ debra:/home/www/marinesoutheast/

Resizing images

mogrify -resize 700×500 *.JPG

This will keep the aspect also.

 
bash_notes.txt · Last modified: 2010/02/19 05:59 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki