Wednesday, 1 July 2015

Difference between http and https

HTTPHTTPS
URL begins with “http://”URL begins with “https://”
It uses port 80 for communicationIt uses port 443 for communication
UnsecuredSecured
Operates at Application LayerOperates at Transport Layer
No encryptionEncryption is present
No certificates requiredCertificates required

Grep command options

grep prints lines of input matching a specified pattern.

1. Search for the given string in a single file
Syntax:
grep "literal_string" filename

2. Checking for the given string in multiple files.
e.g.
$ cp demo_file demo_file1
$ grep "this" demo_*

3. Case insensitive search using grep -i
Syntax:
grep -i "string" FILE

4: -c, --count
 Instead of the normal output, print a count of matching lines for each input file.

5: -v , --invert-match
With the -v, --invert-match option, count non-matching lines.

6: -w, --word-regexp
Select only those lines containing matches that form whole words.

7: -x, --line-regexp
Select only those matches that exactly match the whole line.

8: -L, --files-without-match
Suppress normal output; instead print the name of each input file from which no output would normally have been printed.
The scanning of each file stops on the first match.

9: -l, --files-with-matches
Suppress normal output; instead print the name of each input file from which output would normally have been printed.
The scanning of each file stops on the first match.

10: -m num, --max-count=num
Stop reading a file after num matching lines.

11: -o, --only-matching
Print only the matched (non-empty) parts of matching lines, with each such part on a separate output line.

12: -q, --quiet, --silent
Quiet; do not write anything to standard output.
Exit immediately with zero status if any match is found, even if an error was detected.

13: -s, --no-messages
Suppress error messages about nonexistent or unreadable files.

14: Context Line Control


  • -A NUM, --after-context=NUM 
    • Print NUM lines of trailing context after matching lines. 
    • Places a line containing a group separator (--) between contiguous groups of matches. 
    • With the -o or --only-matching option, this has no effect and a warning is given.
  • -B NUM, --before-context=NUM
    • Print NUM lines of leading context before matching lines. 
    • Places a line containing a group separator (--) between contiguous groups of matches. 
    • With the -o or --only-matching option, this has no effect and a warning is given.