Linux

Piping the output of find into a new command (find, xargs)

E.g. to change the permissions of all directories:

find . -type d -print | xargs /bin/chmod ug+rx

To be able to handle directory names with special characters

find . -type d -print0 | xargs -0 /bin/chmod ug+rx

In order to find all tif files in the current directory or below and to compress them (using the ImageMagick "mogrify" command and LZW compression):

find . -name '*.tif' -print | xargs mogrify -compress LZW

ssh host keys

When reinstalling an ssh server, one should keep the ssh key files from the old system. Otherwise ssh clients will receive messages of like "IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!". If you didn't keep the files, the clients can of course delete the entries from the host key file (usually /home/user/.ssh/known_hosts). When the user connects after that again to the server, the new, changed host key files are added to the host key file.

Pages