How to test ssh connection using bash script in Linux

How to test ssh connection using bash script in Linux

There can be multiple scenarios due to which ssh connection may fail, some of them can be network issues password incorrect passphrase incorrect and many more.. so we will try to rule out all the possible failed scenarios with some pre-checks before we do the actual task to make sure my ssh doesn't get hang ... Read more How to test ssh connection using bash script in Linux

How to check and compare rpm version and release in Linux using bash script

In my last article I had shared some samples script examples to compare decimal values and floating numbers by converting them into integer which can work well for some scenarios but would not be the best solution for this one. Recently I came into a situation where I was supposed to install a hotfix patch ... Read more How to check and compare rpm version and release in Linux using bash script

sed: add or append character at beginning or end of line (row) of a file

You may have some requirement wherein you have to cut a row or get some output from a file and append it to another file as a prefix or suffix. or you know that you have to add some content as a prefix or suffix in front of every line of a file ot may ... Read more sed: add or append character at beginning or end of line (row) of a file

sed: Ignore whitespace while matching a pattern

In my last articles I had shared the arguments with sed which can be used to perform case insensitive actions (search, replace..) in a file and to delete all blank lines from the file. Now suppose you have a set of words or line which want to match and perform some activity but you do ... Read more sed: Ignore whitespace while matching a pattern

sed: perform search and replace only on specific lines (not globally)

By default when we perform search and replace action using sed, that is done globally within a file. Although if you have a line number you can perform the replace based on the line number but what if you have a file where you don't know the line number?Let us got through different examples where ... Read more sed: perform search and replace only on specific lines (not globally)

sed: delete all blank lines from a text file

Here our requirement is to remove all the blank lines from a file. Our sample file [root@golinuxhub ~]# cat /tmp/file This is line one This is line two This is line three This is line four [root@golinuxhub ~]# Use the below command to remove all the blank lines from a text file [root@golinuxhub ~]# sed ... Read more sed: delete all blank lines from a text file