Shell Script Examples: case, count, for, if, while and User input

If you, like so many other people these days, switch to Linux you will come in contact with something called unux scripts, shell scripts or bash scripts. These scripts are text-files that execute commands just like bat-files in Windows. I prefer shell-scripts because i think they are more powerful then bat-files but that is just my opinion.

Some things you should know:
#!/bin/bash usually is the first line in a bash script. It is called shebang (also called a hashbang, hashpling, or pound bang) and specifies in which shell to execute the code that follows below.

Everything after a # is a comment and does not get executed.

Below you will find examples of a few things that you can do with shell scripts on Linux and other Unixes. If you have questions: have a look at the man page of the command or post a comment and I will try to explain. Continue reading “Shell Script Examples: case, count, for, if, while and User input”

A solution to Potential DNS DDoS: named query (cache) ‘./NS/IN’ denied

During the last couple of weeks i have been seeing a lot of messages about denied cache queries on my DNS servers.

month day time server name named[6518]: client ip number#port number: query (cache) ‘./NS/IN’ denied

At first they looked quite innocent and I thought nothing much of them. But after a while the number of logged events grew faster and faster so it was time to do some investigation on google. After reading a few articles I came to the conclusion that my logs where trying to tell me that my DNS server where used as DNS DDoS deflectors. Continue reading “A solution to Potential DNS DDoS: named query (cache) ‘./NS/IN’ denied”

A simple Mac OS X maintenance shell script

I, like so many of my fellow Macintosh users want to keep my OS X installation well maintained. So i sat down and read a few man pages describing those nifty cli utilities that are included in OS X. Since OS X is a UNIX style operating system I decided to create a small shell script to perform the following maintenance tasks for me .

Repair Filesystem Permissions
Verify Disks
Run Periodic (cron) jobs
Update Prebindings
Verify Preference Files
Displa Cache size
Clear Cache

If you find the script interesting and want to use it on your mac you need to perform a few simple steps: Continue reading “A simple Mac OS X maintenance shell script”