Showing posts with label opensource. Show all posts
Showing posts with label opensource. Show all posts

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

Wednesday, January 26, 2011

Split a large file into several small files

To split large file into several smaller files, you can use split command in linux. Just follow the steps below and you will be able to split large file into smaller files.


•From terminal key in
$ split –bytes=1m /path/to/large/file /path/to/output/file/prefix

•Done. You just split your large file into several smaller files

* You can change the output file size by changing the –bytes=1m to your preference. You can
use b, k, or m. b represent bytes, k represent kilobytes, m represent megabytes.

Ex. split --verbose -b 1140000000 jo_old.tar.gz omg -- Filename

It will create omga, omgb and so on...

*To restore the original file, you can use cat command(To join all the smaller file to restore the original file type:-)

$ cat prefix* > NEWFILENAME

Ex. cat omg* > jo_new.tar.gz

* To compare the size from the original file use md5sum

Ex. md5sum jo_old.tar.gz and md5sum jo_new.tar.gz -- ID generated should be the same.


Note: If generated ID is not the same with the original file, repeat the above mentioned steps.

SEO TOOLS

Check Page Rank of your Web site pages instantly:

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