Examples of find usage: find /var/spool -mtime +60 Find every file under the directory /var/spool that was modified more than 60 days ago. find /tmp -name core -type f -print | xargs /bin/rm -f Find files named core in or
Timestamp of yesterday using ‘date’ command
Problem You might need to get a timestamp of yesterday in any script. Analysis Do not think about any scripting and converting dates. Just use the old good ‘date’ command. Solution This script should be self explanatory: #!/bin/bash set -o
Problems receiving mails to server with Greylisting from server using Sender Address Verification
Problem When you implement greylisting on your mailserver you can have a problem to send e-mails to other mail servers which implement Sender Address Verification (SAV). You will see logs such as: Mar 17 14:17:49 ns2 postfix/smtp[6304]: 45D49241802: to=<dest@address.com>, relay=receiver.server.com[X.Y.Z.Q]:25,
Some ‘bash’ Magic
Proces the content of /etc/passwd file field by field Here IFS sets the “internal field delimiter” to “:”, but only inside the while loop. You must NOT reset it to the original value. while IFS=: read name passwd uid gid
‘grep’ Command Examples
Greping beginning of line: $ cat file | grep ‘^text’ x