Monday, May 31, 2010

How to locate all the files recursively which is having a specific pattern?

find / -type f -exec grep -H 'pattern' {} \;

find . -name 'pattern'

For files containing a specific pattern, you can use grep with -r option.

eg. grep -r 'pattern' *

To find all files which contain "pattern"

find . -type f -print0 | xargs -0 grep -l "pattern"

find ./ -iname '*substring*'

grep -r "pattern" /

the above command will look for the pattern from root directory. Other wise you can mention the path from where you want to search.

find . -name "*pattern*" -exec grep -l otherpattern {} +

With the plus, grep will be given as many filenames as the system can handle rather than one file at a time, reducing the number of instances of gre

Sunday, May 30, 2010

ttloop: peer died: EOF

How to get rid of messages ttloop: peer died: EOF

There are possible reasons to it

1. May be faulty network card
2. Port scanning
3. Someone trying to connect to the host

Tuesday, May 18, 2010

add a physical block device to virtualized guest in KVM or XEN

1. Physically attach the hard disk device to the host. Configure the host if the drive is not accessible by default.
2. Configure the device with multipath and persistence on the host if required.
3. Use the virsh attach command. Replace: myguest with your guest's name, /dev/hdb1 with the device to add, and hdc with the location for the device on the guest. The hdc must be an unused device name.

# virsh attach-disk myguest /dev/hdb1 hdc --driver tap --mode readonly

4. The guest now has a new hard disk device called /dev/hdb on Linux. This device may require formatting.