Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory. Now you can throw away that script that allocated a ton of memory just to get rid of the cache…

To use /proc/sys/vm/drop_caches, just echo a number to it.

To free pagecache:

# echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:

# echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

As this is a non-destructive operation and dirty objects are not freeable, the user should run “sync” first!

tmpfs is supported by the Linux kernel from version 2.4 and up. tmpfs (previously known as shmfs) distinguishes itself from the Linux ramdisk device by allocating memory dynamically and by allowing less-used pages to be moved onto swap space. RAMFS, in contrast, does not make use of virtual memory (which can be an advantage or disadvantage). In addition, MFS and some older versions of ramfs did not grow and shrink dynamically and instead used a fixed amount of memory at all times.

Usage of tmpfs for example is “mount -t tmpfs -o size=1G,nr_inodes=10k,mode=0700 tmpfs /space” which will allow up to 1 GiB in RAM/swap with 10240 inodes and only accessible by the owner of the directory /space. The filesystem’s maximum size can also be changed on-the-fly, like “mount -o remount,size=2G /space”.

AND

A bitwise AND takes two binary representations of equal length and performs the logical AND operation on each pair of corresponding bits. In each pair, the result is 1 if the first bit is 1 AND the second bit is 1. Otherwise, the result is 0. For example:

0101
AND 0011
= 0001

XOR

A bitwise exclusive or takes two bit patterns of equal length and performs the logical XOR operation on each pair of corresponding bits. The result in each position is 1 if the two bits are different, and 0 if they are the same. For example:

0101
XOR 0011
= 0110

In Java, all integer types are signed, and the “<<” and “>>” operators perform arithmetic shifts. Java adds the operator “>>>” to perform logical right shifts, but since the logical and arithmetic left-shift operations are identical, there is no “<<<” operator in Java. These general rules are affected in several ways by the default type promotions; for example, since the eight-bit type byte is promoted to int in shift-expressions,[2] the expression “b >>> 2” effectively performs an arithmetic shift of the byte value b instead of a logical shift. Such effects can be mitigated by judicious use of casts or bitmasks; for example, “(b & 0xFF) >>> 2” effectively results in a logical shift.

<TAG\b[^>]*>(.*?)</TAG> matches the opening and closing pair of a specific HTML tag. Anything between the tags is captured into the first backreference. The question mark in the regex makes the star lazy, to make sure it stops before the first closing tag rather than before the last, like a greedy star would do.

It looks like the beta version of Google’s new browser is available starting today. Haven’t spotted the beta download yet, but Google has attempted to explain the project in an online comic.

The browser’s called “Chrome.” The download page is supposedly here, but at the moment that just redirects to the main Google search page.

MIPS is short for Millions of Instructions Per Second. It is a measure for the computation speed of a program. Like most such measures, it is more often abused than used properly (it is very difficult to justly compare MIPS for different kinds of computers).

BogoMips are Linus’s own invention. The linux kernel version 0.99.11 (dated 11 July 1993) needed a timing loop (the time is too short and/or needs to be too exact for a non-busy-loop method of waiting), which must be calibrated to the processor speed of the machine. Hence, the kernel measures at boot time how fast a certain kind of busy loop runs on a computer. “Bogo” comes from “bogus”, i.e, something which is a fake. Hence, the BogoMips value gives some indication of the processor speed, but it is way too unscientific to be called anything but BogoMips.

The reasons (there are two) it is printed during boot-up is that a) it is slightly useful for debugging and for checking that the computers caches and turbo button work, and b) Linus loves to chuckle when he sees confused people on the news.

As performance engineer I come across various problems.� Here is one when the server crashed due to lack of free memory. See the error here.
Read on »

To get a list of all running processes, enter the command “ps auxw”. You might also want to try using “ps auxf” (or “ps auxfw” if the lines get truncated) – this prints everything in a nice tree format that may give you a better understanding of how and why things are running.

To get a complete listing of all listening network services using netstat, enter: netstat -altpu

You can also get similar information using lsof by entering: lsof -i | egrep -i ‘LISTEN|UDP’

Pattern matching example:

awk '/foo1/ && /foo2/ { print $1 }'  

To use shell variables simply do the following:

foo1={pattern1}
foo2={pattern2}

awk "/$foo1/ && /$foo2/"'{ print $1 }'  

Crontab syntax :
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.

* in the value field above means all legal values as in braces for that column.

The value column can have a * or a list of elements separated by commas. An element is either a number in the ranges shown above or two numbers in the range separated by a hyphen (meaning an inclusive range).

Example:
55 23 * * * $HOME/automation/getStats.sh > $HOME/automation/logs/cron.logs 2>&1
* to avoid getting emails on Linux from cron, you can disable by appending    ‘>/dev/null 2>&1’ .