+
+
Searching your soulmate in linux
T K Sourabh
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.
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
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'