Saturday, February 5, 2011

Linux Command

watch runs command repeatedly, displaying its output (the first screenfull). This allows you to watch the program output change over time. By default, the program is run every 2 seconds; use -n or --interval to specify a different interval.

To watch for mail, you might do

watch -n 60 from

To watch the contents of a directory change, you could use

watch -d ls -l

To watch mysql replication

watch -n -3 "mysql -u root -e 'show slave status\G;'"

To watch the increasing size of a file

watch -n -3 'ls -alh'



AWK--- Finds lines in files that match a pattern and performs specified actions on those lines

TAIL --
The tail command reads the final few lines of any text given to it as an input and writes them to standard output (which, by default, is the monitor screen).

Example:

tail -f /var/log/squid/access.log | awk '{print $3" " $4 " "$7}'


Output:
192.168.x.x TCP_MISS/200 http://www.rbcinsurance.com/uos/_assets/images/icons/magnifier-large.gif
192.168.x.x TCP_MISS/200 http://www.rbcinsurance.com/uos/_assets/images/icons/tips-large.gif
192.168.x.x TCP_MISS/200 http://www.rbcinsurance.com/uos/_assets/images/layout/homepagelinkgrid-row-bg.gif
192.168.x.x TCP_HIT/200 http://mirror.cse.iitk.ac.in/fedora-archive/fedora/linux/releases/8/Everything/i386/os/repodata/repomd.xml

1 comment:

SEO TOOLS

Check Page Rank of your Web site pages instantly:

This page rank checking tool is powered by Page Rank Checker service