
mtr(My Trace Route) is a nice network diagnostic tool combines the functionality of the ‘traceroute’ and ‘ping’ programs and can see even the packet in the network. It comes along with default installtion if ubuntu. To know more type man mtr or follow here . Typical example if usage is below.
Syntax::
mtr <IP> -n
Below shows the trace to an IP with mtr tool

Tags: finding packet loss, mtr, network diagnostic tool.traceroute
Sox(Sound eXchange, the Swiss Army knife of audio manipulation) is a strong audio manipulation too in linux. SoX reads and writes audio files in most popular formats and can optionally apply effects to them; it can combine multiple input sources, synthesise audio, and, on many systems, act as a general purpose audio player or a multi-track audio recorder. So it can be told as audio player as well as converter.Till some days before i was searching a linux tool for playing gsm files eventhough i were using sox for sound conversion i didnt noticed that it can play sound files allmost in all format for that we just need to install corresponding codecs .
To install sox
$ sudo apt-get install sox
sox supported formats are
AUDIO FILE FORMATS: 8svx aif aifc aiff aiffc al amb au avi avr caf cdda cdr cvs cvsd dat dvms f4 f8 fap ffmpeg flac fssd gsm hcom htk ima ircam la lpc lpc10 lu m4a mat mat4 mat5 maud mp2 mp3 mp4 mpg nist ogg paf prc pvf raw s1 s2 s3 s4 sb sd2 sds sf sl smp snd sndfile sndr sndt sou sox sph sw txw u1 u2 u3 u4 ub ul uw vms voc vorbis vox w64 wav wavpcm wmv wv wve xa xi PLAYLIST FORMATS: m3u pls AUDIO DEVICE DRIVERS: alsa ao oss ossdsp
to get support of all this formats install
$ apt-get install libsox-fmt-all
We can play specified file format using the play command which come along with sox.
Eg:

Tags: audio converter in linux, gsm player, gsm player in linux, sound converter in linux, sox
It is necessary in certain cases we need to check whether the system or server is alive and if we want some alert like email or sms to inform you that the system is down.We can do it by a simple shell script .All we need is to install a package call fping
fping is a program like ping which uses the Internet Control Message Protocol (ICMP) echo request to determine if a target host is responding. fping differs from ping in that you can specify any number of targets on the command line, or specify a file containing the lists of targets to ping. Instead of sending to one target until it times out or replies, fping will send out a ping packet and move on to the next target in a round-robin fashion.
installing command
sudo apt-get install fping
Script:
#!/bin/sh
status=`fping 192.168.1.22 | cut -d ' ' -f 3`
if [ $status != "alive" ]
then
echo 'system is down' //Here use your alert as you like email, sms, voice alert etc
fi
Will check the system with IP 192.168.1.22 alive or not.Put it as a cron job and schedule the time interval to automatically check system status and get the alert…:)
Tags: Checking alive system shell script., Shell script for checking a sytem alive or not
mtop or MySQL top command shows the MySQL commands consuming the greatest time.It is a command similar as top which provides a dynamic real-time view of a running system. Top can display system summary information as well as a list of tasks currently being managed by the Linux kernel.Difference is that mtop show only the MySQL tasks.
Normally, run as a console program this will allow you to see slow or badly optimized queries as they will stay on the screen for a while. However, if you are hunting for short lived queries, running in the manualrefresh mode with a short refresh time will allow you to catch short lived queries as well.
Installing mtop
sudo apt-get install mtop
Tags: mtop, mtop - MySQL top, mysql top

Htaccess is a password protection scheme used by Apache Web servers.The web server will ask an authentication to enter if we set a password for it.Here the steps explains how to set an authentication for the web folder.
- Create a file called .htaccess in your web folder which you want to protect.
- Open the file .htaccess in your favorite editor.
- Paste the lines below.
AuthUserFile /var/www/.htpasswd
AuthGroupFile /dev/null
AuthName "Protected files"
AuthType Basic
require user bipin
- Change the path of .htpasswd in AuthUserFile where you are going to place the .htpasswd file.
- Change AuthName to from “Protected files” to any name you would like.
- Change require user to any user name you would like to give (This will be the authentication user name it will ask).
- issue command htpasswd -c <htpasswd path> <username> for password setting . For me it is htpasswd -c /var/www/.htpasswd bipin
- Edit httpd.conf file or the web configuration file of apache.It should be like this.
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
#AllowOverride none
Order allow,deny
allow from all
</Directory>
Uncomment AllowOverride AuthConfig if it got commented.
Now onwards it will ask an authentication to enter into it.

By the installation of Linux on a Windows installed machine the default loading OS becomes the Linux. If the user want to change the default one we have to edit the boot loader file of linux OS.
The name and disk location of the GRUB configuration file varies from system to system; for example, in Ubuntu, Debian GNU/Linux and openSUSE the file is stored in /boot/grub/menu.lst while Fedora and Gentoo Linux uses /boot/grub/grub.conf. Fedora also provides a symbolic link from /etc/grub.conf to /boot/grub/grub.conf for FHS compatibility reasons and other distros can establish symbolic links to the three locations.
Tags: Editing boot loader, Editing grub, Linux, Ubuntu

Well we have created a PHP daemon.One major issue with all daemon is that some time it got killed with out any reason.Here we have a solution for monitoring the daemon with a utility called monit.monit is a utility for managing and monitoring, processes, files, directories and devices on a Unix system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. E.g. monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses to much resources. You may use monit to monitor files, directories and devices for changes, such as timestamp changes, checksum changes or size changes.
For doing it install the utility first
sudo apt-get install monit
We have to edit some configuration file to make the monit work.
Edit sudo vim /etc/default/monit
Set startup=1 from 0
Edit sudo vim /etc/monit/monitrc
This is the file where we specify what to monit
Uncomment
set daemon 60 #will check the daemon every 1 minute
set httpd port 2812 and
use address localhost # only accept connection from localhost
allow localhost # allow localhost to connect to the server and
#specifying the program for monitor
check process php with pidfile "/var/run/process.pid"
start = "/usr/bin/php /var/www/voicealerts/process.php"
stop = "/usr/bin/php /var/www/voicealerts/process.php"
Line 1 starts a process service entry. It contains the keyword check and a descriptive name for he process to monitor, in this case php. Monit also require the process pidfile to be stated.
If you want monit to start, stop or restart the process you must submit a start and stop program.
Line 2-3 defines those programs for this process
Write and quite the file and check the syntax is ok with command
sudo monit -t
start monit deamon by
sudo /etc/init.d/monit start
start the files specified in the monitrc by
sudo monit start all
check the status of our daemon
sudo monit status
This is a sample configuration monitors the PHP daemon process mentioned in the above post.
Tags: Monitoring a daemon, Monitoring a PHP daemon

Audacity is a free digital sound editing application we can import sound format like mp3, wav etc and edit and export to any other sound format.
To install audactiy in ubuntu issue
sudo apt-get install audacity
One of the issue facing with audacity application is that the export to mp3 fromat will not work in the default installation.This is due to the absence of the lame mp3 encoder.
To solve this install it as follows.
sudo apt-get install lame
sudo apt-get install lame-extras
sudo apt-get install lame-dev
sudo apt-get install liblame0
Tags: Audacity mp3 export
Nmap is a tool that can be used to check the network status as well as the status of a particular port.
To install nmap issue
sudo apt-get install nmap
eg:
To check the status of a particular port in the local host we can issue
nmap -p 80 localhost
will give
Starting Nmap 4.53 ( http://insecure.org ) at 2008-04-17 18:58 IST
Interesting ports on localhost (127.0.0.1):
PORT STATE SERVICE
80/tcp open http
if its open.Similarly we can give any host name.
For scanning a network is live or not we can give
nmap -sP -vv 192.168.0.* | grep up
Host 192.168.0.1 appears to be up.
Host 192.168.0.100 appears to be up.
Host 192.168.0.101 appears to be up.
Host 192.168.0.102 appears to be up.
Host 192.168.0.103 appears to be up.
Host 192.168.0.104 appears to be up.
Host 192.168.0.111 appears to be up.
Host 192.168.0.112 appears to be up.
Host 192.168.0.115 appears to be up.
Host 192.168.0.117 appears to be up.
Nmap done: 256 IP addresses (10 hosts up) scanned in 4.630 seconds
will give this if all are up
Tags: nmap, nmap network exploration tool, scanning a network is live with nmap
It is some time necessary to automatically download a file from a ftp server daily.We can automate it by writing a shell script and putting it as a cron.A sample script is show below.When it got run it will login and download the file “1.txt” in to the current working folder from the directory “ftp” in the ftp server.
#!/bin/sh
rm 1.txt
HOST=’213.104.257.88′
PORT=’21′
USER=’bipin’
PASSWD=’bipin’
FILE=’1.txt’
ftp -n $HOST $PORT <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd ftp
bin
get $FILE
quit
END_SCRIPT
exit 0
Tags: Shell script for ftp download, Shell script ftp download