30 Mayıs 2013 Perşembe

Search a keyword in pdf files in a directory

To search for a particular keyword in all pdf files under a directory :
ls *.pdf | xargs -I{} pdftotext {} - | grep -i "keyword"
You can see corresponding lines, but if you want to see file names instead of content, use following statement :
for f in $(find . -name '*.pdf'); do  pdftotext -q $f - | grep -i -q "keyword" && echo $f; done

30 Ocak 2012 Pazartesi

RTFM

Komut hakkında nasıl bilgi alırız ?

kursat@kursat:~$ whatis grep
grep (1)             - print lines matching a pattern
kursat@kursat:~$ 

Bu komut için manual page araştıralım 

kursat@kursat:~$ apropos grep
bzegrep (1)          - search possibly bzip2 compressed files for a regular expression
bzfgrep (1)          - search possibly bzip2 compressed files for a regular expression
bzgrep (1)           - search possibly bzip2 compressed files for a regular expression
egrep (1)            - print lines matching a pattern
fgrep (1)            - print lines matching a pattern
git-grep (1)         - Print lines matching a pattern
grep (1)             - print lines matching a pattern
msggrep (1)          - pattern matching on message catalog
pgrep (1)            - look up or signal processes based on name and other attributes
rgrep (1)            - print lines matching a pattern
xzegrep (1)          - search compressed files for a regular expression
xzfgrep (1)          - search compressed files for a regular expression
xzgrep (1)           - search compressed files for a regular expression
zegrep (1)           - search possibly compressed files for a regular expression
zfgrep (1)           - search possibly compressed files for a regular expression
zgrep (1)            - search possibly compressed files for a regular expression
zipgrep (1)          - search files in a ZIP archive for lines matching a pattern
kursat@kursat:~$ 


yahut aynı şeyi yapan man -k

kursat@kursat:~$ man -k grep
bzegrep (1)          - search possibly bzip2 compressed files for a regular expression
bzfgrep (1)          - search possibly bzip2 compressed files for a regular expression
bzgrep (1)           - search possibly bzip2 compressed files for a regular expression
egrep (1)            - print lines matching a pattern
fgrep (1)            - print lines matching a pattern
git-grep (1)         - Print lines matching a pattern
grep (1)             - print lines matching a pattern
msggrep (1)          - pattern matching on message catalog
pgrep (1)            - look up or signal processes based on name and other attributes
rgrep (1)            - print lines matching a pattern
xzegrep (1)          - search compressed files for a regular expression
xzfgrep (1)          - search compressed files for a regular expression
xzgrep (1)           - search compressed files for a regular expression
zegrep (1)           - search possibly compressed files for a regular expression
zfgrep (1)           - search possibly compressed files for a regular expression
zgrep (1)            - search possibly compressed files for a regular expression
zipgrep (1)          - search files in a ZIP archive for lines matching a pattern
kursat@kursat:~$ 



28 Kasım 2011 Pazartesi

canlı yayında wireshark (linux)

ssh root@192.168.2.28 tcpdump -s 1500 -l -w- 'port!22' | wireshark -k -i -

13 Mart 2011 Pazar

GIT

Yükledin mi bacım giti, bi de gitk yükle şekilli olsun.

apt-get install git-core
apt-get install gitk

Yaz adını sanını tanısın seni ballim

git config --global user.name "Peyder Pey"
git config --global user.email "pey@derpey.com"


Git şimdi kodunun olduğu klasöre, bu klasörün altında kullanacağız git'i. Şimdi gitin cersiyonlamasını istemediğimiz dosya tipleri için .gitignore diye bi dosya yaratıp içine yazıver neyi eklemesini istemiyosan.

Mesela : 
cat .gitignore 
*.d
*.o
*.sh
*project
*cproject

6 Şubat 2011 Pazar

Shell Script'te tırnaklar uzadımıydı kesiceksin

` ` arasında komut çalıştırır
nand_partition=`uboot-printenv nand_ubifs_root| grep -e '=' | cut -c2-`
echo $nand_partition
if [ $nand_partition -eq 5 ]
then
        flash_eraseall /dev/mtd8;
        ubiattach /dev/ubi_ctrl -m 8;
        ubimkvol /dev/ubi2 -m -N mtdbackup;
        mount -t ubifs ubi2:mtdbackup /mnt/MtdBackup -o sync;
        echo "partition 8 attached";
fi 



“ ” arasındaki karakter gösterir
' ' arasındaki de değişmez

31 Ocak 2011 Pazartesi

linuxta fdisk muhabbetleri

listele beybi

kursat@kursat:~$ sudo fdisk -l
[sudo] password for kursat:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000001

Device Boot Start End Blocks Id System
/dev/sda1 * 1 9561 76798701 7 HPFS/NTFS
/dev/sda2 9562 17327 62380395 7 HPFS/NTFS
/dev/sda3 17328 19457 17109225 5 Extended
/dev/sda5 17328 19362 16346106 83 Linux
/dev/sda6 19363 19457 763056 82 Linux swap / Solaris


18 Ocak 2011 Salı

Embedded kutu içerisinde pcap almak için

tcpdump ı arm a göre compile dip koyarız.
Akabinde aşağıdaki komutla istediğimiz interface i dinleriz.

./tcpdump -s 0 -w test.pcap -i eth0