+

+

Searching your soulmate in linux

T K Sourabh

Searching your soul-mate in Linux

What?

Familiarize you with various search tools

 

and our Mission: finding your soul-mate

Using `whatis` command

~$ whatis <command-name>


find (1)     - search for files in a directory hierarchy

awk (1)      - pattern scanning and processing language

grep (1)     - print lines matching a pattern

sed (1)      - stream editor for filtering and transforming text

cat (1)      - caoncatenate files and print on the standard output

ack (1p)     - grep-like text finder

ag (1)       - The Silver Searcher. Like ack, but faster.

Mission 01

  • find `soulmate_01.jpg`
  • it's path is in one of the files
  • find the path and open using xdg-open

Commands to be used

 

~$ ag "soulmate_01" |  cut -d ' ' -f 2

~$ xdg-open <path-name-here>

Alternative methods

# grep searches the whole `.git`,which we dont want
# so we excluded `.git` altogether 

~$ grep soulmate_01 $(find . -type f | grep -v '\.git') | cut -d ' ' -f 2


# Or if we know in which file the path exists we simply do

~$ grep <pattern> <file-name>

or

~$ find -type f -name <file-name.ext>

A message from someone in file that says

`yeh bik gayi hain py file` arrives.

Calling `Liam Neeson`

Mission 02

  • Find the file which contains the secret message

NOTE: and never ever store sensitive info in plain text format.EVER.

ack? who?

Ack = `find` + `grep`


~$ find . -name '*.py' | xargs grep soulmate

# or you can do this

~$ ack --py soulmate

What to do to find a file when you know the file name?

find -type f -name '*putin.jpg'

Thanks

Searching your soul-mate in linux

By tk sourabh

Searching your soul-mate in linux

  • 1,870