Tag archives for linux - Page 2
How to check certificate validity in Linux?
This article help you to check certificate expiry date from Linux command line using openssl utility. Check SSL certificate expiration date Syntax: openssl x509 -enddate -noout -in <certificate name> openssl x509 -enddate -noout -in openssl x509 -enddate -noout -in
Could not resolve host: mirrorlist.centos.org Centos 7
I have installed Centos 7 in Vmware WorkStation. I tried to install few new packages using yum install. However, I was getting error "Could not resolve host: Centos 7" [root@localhost ~]# yum install dos2unix Loaded plugins: fastestmirror Could not retrieve mirrorlist ;arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve…
Pass date as mandatory arguments in bash script
Pass date as mandatory arguments in bash script I came across a use case where I have to write a shell script to perform some action on two date ranges. The first argument would start date and the second argument as end date. To validate missing argument we can also…
How to define multiline string variable in shell?
How to define multiline string variable in shell? In your bash/shell scripting experience you may face scenario where you need to define multi line string variable. Here is multiple ways to define multi line string variable in shell. Method 1: Combine Multiline with \n like below and echo with -e…
Shell script to pass multiple arguments with options
Shell script to pass multiple arguments with options This tutorial will help you to pass multiple arguments in a more organized manner. I have used two arguments "t" and "d" here. The first argument "t" will accept task value and based on the task value you can perform the respective…
Cut and paste in Vim editor
Here is the simple step by step guideline to cut and paste in Vim editor. Press esc if vim editor in insert mode Position the cursor where you want to start cutting. Press v to select the characters and move the cursor at end of character you want to cut.…
How to Run a Linux Script During Reboot or Startup
How to Run a Linux Script During Reboot or Startup I come across one use case where I need to run a Linux script during reboot or startup of the system. To handle this use-case I have created new script in / Lets consider the below example script. / #! /bin/sh…
Deleting Lines Containing Specific string from multiple files
Deleting Lines Containing Specific string from multiple files Deleting Lines Containing Specific string from multiple files recursively Syntax: grep -Rl "STRING" /directory/path/ | xargs sed -i "/STRING/d" Example: Below example delete lines containing @license tag from src/main/php directory all files recursively grep -Rl "@license" src/main/php | xargs sed -i "/@license/d"…
Get the List of Files and Directories Recursively in Linux
Simple bash Script to get the list of files and directories inside the specified path Sometimes we want to get the list of files and directories recursively, but it is tedious to navigate each directory to check all the files. Here are the simple commands which will help you to…
How to Delete a Git branch?
Delete a git branch This article will demonstrate, how we can delete a git branch from local or remote git repository. Syntax: git branch -d<branch> git branch -d test-branch If you face any error like "error: The branch 'test-branch' is not fully merged" and you are still want to delete…


