Linux Check File Exist or not – Shell Script

The following script used to check the specified file present or not in shell script

#!/bin/bash
#########################################################################################
# This Shell script used to find the specificed
file exixts or not on particular location #########################################################################################

filePath="/home/file-path"
fileName="$filePath/filename.txt"
if [ -f "$fileName" ]
then
echo "$fileName found"
else
echo "$fileName not found"
fi

To check multiple file on same if condtion

filePath="/home/file-path"
fileName="$filePath/filename.txt"
fileName2="$filePath/filename2.txt"
if [ -f "$fileName" ] && [ -f "$fileName2" ]
then
echo "$fileName found"
else
echo "$fileName not found"
fi

vi Editor – Searching and Replacing

Searching and Replacing

The formal syntax for searching is:

:s/string

For example, suppose you want to search some text for the string “cherry.” Type the following and press ENTER:

:s/cherry

The first match for “cherry” in your text will then be highlighted. To see if there are additional occurrences of the same string in the text, type n, and the highlight will switch to the next match, if one exists.

The syntax for replacing one string with another string in the current line is

:s/pattern/replace/

Here “pattern” represents the old string and “replace” represents the new string. For example, to replace each occurrence of the word “lemon” in a line with “orange,” type:

:s/lemon/orange/

The syntax for replacing every occurrence of a string in the entire text is similar. The only difference is the addition of a “%” in front of the “s”:

:%s/pattern/replace/

Thus repeating the previous example for the entire text instead of just for a single line would be:

:%s/lemon/orange/

Src From : http://www.linfo.org/vi/search.html

Pilish

Pilish is a style of writing in which the lengths of consecutive words match the digits of the number π (pi).

The following sentence is an example which matches the first fifteen digits of π:
How I need a drink, alcoholic in nature, after the heavy lectures involving quantum mechanics!

The following Pilish poem (written by Joseph Shipley) matches the first 31 digits of π:
But a time I spent wandering in bloomy night;
Yon tower, tinkling chimewise, loftily opportune.
Out, up, and together came sudden to Sunday rite,
The one solemnly off to correct plenilune.

A full-length Pilish novel has been published,which currently holds the record of the longest Pilish text with 10,000 digits.

In order to deal with occurrences of the digit zero, the following rule set was introduced (referred to as Basic Pilish):
In Basic Pilish, each word of n letters represents
(1) The digit n if n < 10
(2) The digit 0 if n = 10

Since long runs of small non-zero digits are difficult to deal with naturally (such as 1121 or 1111211), another rule set called Standard Pilish was introduced:
In Standard Pilish, each word of n letters represents
(1) The digit n if n < 10
(2) The digit 0 if n = 10
(3) Two consecutive digits if n > 10
(for example, a 12-letter word represents the digits 1,2)

Src: http://en.wikipedia.org/wiki/Pilish

The Difference between a Megabyte (MB) and a Megabit (Mb)

One thing that often gives people confusion is the difference between a Megabyte (used for file size) and a Megabit (used for download speeds). People often assume that a download speed of 1 Megabit per second (1 Mbps) will allow them to download a 1 Megabyte file in one second. This is not the case, a Megabit is 1/8 as big as a Megabyte, meaning that to download a 1MB file in 1 second you would need a connection of 8Mbps. The difference between a Gigabyte (GB) and a Gigabit (Gb) is the same, with a Gigabyte being 8 times larger than a Gigabit.

To calculate how long it will take a file to download over your connection, you can use Google’s simple MB/Mb converter

Cloudflare – Creating a better web and supercharge your website (Free & Premium plan)

  • CloudFlare protects and accelerates any website online. Once your website is a part of the CloudFlare community, its web traffic is routed through our intelligent global network. cloudflare automatically optimize the delivery of your web pages so your visitors get the fastest page load times and best performance. cloudflare also block threats and limit abusive bots and crawlers from wasting your bandwidth and server resources. The result: CloudFlare-powered websites see a significant improvement in performance and a decrease in spam and other attacks.
  • Services include CDN, Optimizer, Security, Analytics, apps also enterprise plans there.
    Ref:

VigLink – Powering content driven commerce

  • VigLink is the platform on which site-to-site clicks are priced, bought, and sold.
  • VigLink’s content monetization solution connects potential consumers to products by hyperlinking particular keywords in a website’s content.
  • The company’s technology, VigLink Insert, scans a page for words that could be potentially profitable to the publisher of the page, and connects the keyword with a product from an affiliate program. The publisher is paid when a reader clicks a link contained in the content to buy or learn more about a service or product.
  • VigLink also offers an outbound analytics service for clients to understand where readers go when they leave their site

    Ref : 

        Official site : https://www.viglink.com/

Why name Apache?

From wikipedia

According to the FAQ in the Apache project website, the name Apache was chosen out of respect to the Native American tribe Apache and its superior skills in warfare and strategy. The name was widely believed to be a pun on A Patchy Server (since it was a set of software patches), but this is erroneous. Official documentation used to give this very explanation of the name,but in a 2000 interview, Brian Behlendorf, one of the creators of Apache, set the record straight:

The name literally came out of the blue. I wish I could say that it was something fantastic, but it was out of the blue. I put it on a page and then a few months later when this project started, I pointed people to this page and said: “Hey, what do you think of that idea?” … Someone said they liked the name and that it was a really good pun. And I was like, “A pun? What do you mean?” He said, “Well, we’re building a server out of a bunch of software patches, right? So it’s a patchy Web server.” I went, “Oh, all right.” … When I thought of the name, no. It just sort of connotated: “Take no prisoners. Be kind of aggressive and kick some ass.”

From web archive

The Apache group was formed around a number of people who provided patch files that had been written for NCSA httpd 1.3. The result after combining them was A PAtCHy server.

Ref:

http://web.archive.org/web/19970415054031/www.apache.org/info.html

http://en.wikipedia.org/wiki/Apache_HTTP_Server#Name