March 16, 2010

Nagios – An Introduction

Linux General,Monitoring,

What is Nagios? Nagios is a framework for setting up monitoring of hosts, services, and networks . What are the components of Nagios? nagios – the main server software and web scripts nagios-plugins – the common set of check scripts used to query services nagios-nrpe – Nagios Remote Plugin Executor nagios-nsca – Nagios Service Check…

Read more
March 13, 2010

Difference between Buffer and Cache

Linux General,

Buffers are allocated by various processes to use as input queues, etc. Most of the time, buffers are some processes’ output, and they are file buffers. A simplistic explanation of buffers is that they allow processes to temporarily store input in memory until the process can deal with it. Difference between Buffer and Cache Cache…

Read more
March 13, 2010

Memory Usage in Linux

Linux General,

Check the memory usage on a linux system with the command given below. The free command helps in getting the memory usage  in the system [rams@stopprepare-lx ~]$ free -m total       used       free     shared    buffers     cached Mem: 1002        985         17          0         93        380 -/+ buffers/cache: 512        490 Swap: 2055          0       2055 Total Memory in the system…

Read more
March 13, 2010

Rendering MySQL query results in vertical format

FreeBSD,Linux General,MySQL,

Easily reviewing SELECT query results in a shell window can be particularly difficult when a table consists of numerous columns. Remedying this inconvenience is easily done by appending the \G switch to the query: mysql>SELECT * from users WHERE id=1\G Executing this query with the \G switch attached formats the output like so: mysql test>select…

Read more
March 13, 2010

Disable the Error Beep in MySQL

Linux General,

To temporarily disable the beep, pass –no-beep along when logging into the server: %>mysql -u root -p –no-beep To permanently disable this annoyance, add no-beep to the [client] section of your .my.cnf file.

Read more
March 13, 2010

How FreeBSD identifies hard disks and drives

Linux General,

FreeBSD identifies various types of hard disks and drives with following naming convention ad ATAPI (IDE) disk da SCSI direct access disk acd ATAPI (IDE) CDROM cd SCSI CDROM fd Floppy disk To know the hardware detected by the kernel at boot time refer the file /var/run/dmesg.boot or use the command dmesg. The various hard…

Read more
March 13, 2010

Create strong passwords in Unix

FreeBSD,Linux General,

openssl command helps in creating strong passwords for user accounts, email addresses, web forms etc. openssl rand 12 -base64 The above command will create a random base 64 encoding string each time it’s run.

Read more
March 13, 2010

Attach words horizontally using shell scripting

Linux General,

To paste contents of two files horizontally, paste command can be used. Create a file called cmd with the following content: # cat cmd /usr/sbin/useradd /usr/sbin/useradd /usr/sbin/useradd Create another file called newusers # cat newusers tom dick harry Now run the following command # paste -d ” ” cmds newusers > add.sh The -d ”…

Read more
March 13, 2010

Find empty files in Linux

Linux General,

find command provides two options to detect empty files $ find . -size 0c or $ find . -empty To find and delete all the empty files under the current directory at one go $ find . empty -exec rm -f {} \; To find and delete all empty directories under the current directory $…

Read more
March 13, 2010

Capture top command output in a file

FreeBSD,Linux General,Shell Scripting,

Capture top command output in a file The output of top command can be captured as follows top -b -n1 > /tmp/top1.txt This will run top command once and write the output to a file, then exit. To run top 3 times with an interval of 5 seconds, run the following command top -b -n3…

Read more