Month: January 2014

Create file with random data and specific size

Here is a quick bash one liner to to create a file with random data and a specific file size This command will create a 2 MB file with random contents: $ dd if=/dev/urandom of=test.zip bs=1M count=2 2+0 records in 2+0 records out 2097152 bytes (2.1 MB) copied, 0.208422 s, 10.1 MB/s To view the…


linux-dash

Hi, Here is a nifty little monitoring utility with a clean GUI interface that is a drop-in, low-overhead monitoring web dashboard for a linux machine. Monitors your server with stats on your precious hardware. Update individual stats on demand. :::Demo:::


Identifying PHP Spam

To identify PHP Spam when running PHP 5.3 or higher: (Please note the variables below are not enabled by default in php.ini) utilize the following php.ini variable to narrow down the offending script. If you suspect there is a PHP script sending out email (and it is still doing so) try adding these two lines:…


check-httpd.sh

Here is a quick little bash script to let you know if apache is up and running or not and will email a specific user with details. cd /root/bin/ touch check-httpd.sh vim check-httpd.sh add script below to check-httpd.sh file #!/bin/bash FILE=apache-snapshot.txt DIR=/root #set this and then uncomment the mail command on 38 MAILTO=email@domain.com SUBJECT=”APACHE_DOWN-host.mydomain.com” LOAD=`cat…


CIDR Notation

CIDR stands for Classless Inter-Domain Routing. CIDR was developed in the 1990s as a standard scheme for routing network traffic across the Internet. /27      1/8th of a Class C     32 hosts /26      1/4th of a Class C     64 hosts /25      1/2 of a Class C       128 hosts /24      1 Class C              256 hosts /23      2…


Setup bash_eternal_history

In order to setup eternal bash history for all users: vim /etc/bashrc insert if [ “$BASH” ]; then export HISTTIMEFORMAT=”%Y-%m-%d_%H:%M:%S ” export PROMPT_COMMAND=”${PROMPT_COMMAND:+$PROMPT_COMMAND ; }”‘echo “`date +’%y.%m.%d-%H:%M:%S:’`” $USER “(“$ORIGINAL_USER”)” “COMMAND: ” “$(history 1 | cut -c8-)” >> /var/log/bash_eternal_history’ alias ehistory=’cat /var/log/bash_eternal_history’ readonly PROMPT_COMMAND readonly HISTSIZE readonly HISTFILE readonly HOME readonly HISTIGNORE readonly HISTCONTROL fi Then…


darkstat

http://unix4lyfe.org/darkstat/ darkstat is an ntop-workalike network statistics gatherer. It runs as a background process on a cable or DSL router, uses libpcap to capture network traffic, and has a Web interface that serves up reports of statistics such as data transferred by host, port, and protocol. It also has a neat bandwidth usage graph….


The ‘at’ command

The “at” command lets you execute a command or script at a later time, you can set the time in many different ways and even have the result mailed to you after the command has been executed. Here are some examples:…