How to add line number at the beginning of each line
There are many ways to do this, I will try to show someSample file '/tmp/file'AppleApricotAvocadoBananaBilberryBlackberryBlackcurrantMethod 1Using 'nl'# nl /tmp/file 1 Apple 2 Apricot 3...
View Articlesed: match string and append new line (before or after)
Before is the requirement for this example.I have a sample file with below content at /tmp/fileThis is line oneThis is line twoThis is line threeThis is line fourHere in we have to put our content...
View Articlesed :Replace whole line when match found
Here our requirement is to replace a line with our content when a match is found with in the fileOur sample file /tmp/fileThis is line oneThis is line twoThis is line threeThis is line fourHere we will...
View Articlesed: Replace string based on line number (certain line)
Here our requirement is that we have a file where we have to perform a string replacement but based on line number.Below is our sample data /tmp/file1 This is line one2 This is line two3 This is line...
View Articlesed: Insert multiple lines before or after pattern match
Our requirement is to add multiple lines after a pattern is matched in a newline which can be before or after the match based upon the requirementBelow is our sample file /tmp/fileThis is line oneThis...
View Articlesed: remove all leading and ending blank whitespace from a file
Here our requirement is to remove all the whitespace from the leading and ending space per line of a file.Our sample file /tmp/file This is line one This is line two This is line three...
View ArticleHow to configure yum server repository using iso dvd
If you are not already aware of "YUM" (Yellowdog Updater, Modified) is used for installing rpms.Yum allows automatic updates, package and dependency management, on RPM-based distributions. Ideally yum...
View ArticleHow to reduce LVM size in Linux step by step (online without reboot)
Do you have a node where there is a lot of free space available on some logical volume which is unused while there is a different partition which you are using is going out of space?In such cases you...
View ArticleHow to fix "Software selection (Source changed - please verify)"
This is one of the most common error you will face if you are working on unattended Red Hat Linux installation where you have a customised list of Packages.Error:Solution:This error basically means...
View ArticleHow to find out on which core a process is running on in Linux
There are many processes in Linux which run on single core while many will switch between different core depending upon the availability.With below two methods you can find if a process is continuously...
View ArticleHow to make IO disk scheduler change reboot persistent in Linux
I/O scheduling controls how input/output operations will be submitted to storage. There are various algorithms which can be used depending upon the end user requirement.These algorithms can help to...
View ArticleSample kickstart configuration file for RHEL/Centos 7
In this article I will share separate sections of a kickstart file which can be used based on your requirement.A sample kickstart configuration file can be collected from...
View ArticleChoosing The Right VPN As A Linux User
We use Linux for many reasons. Security is just one of them, but it’s undeniable that Linux is more secure than other operating systems. Securing our data is especially important to us, since our...
View ArticleHow to configure different types of network in Oracle Virtualbox (Linux)
There are multiple types of network which can be configured in Oracle VirtualBox, so before going ahead you must be clear on your requirement. Here let me give you a brief overview of the type of...
View ArticleHow to disable consistent network device naming in Red Hat Linux 7
With Red Hat Enterprise Linux 7 they have introduced a network device naming scheme wherein it provides methods for consistent and predictable network device naming for network interfaces. These...
View ArticleHow to auto logout(timeout) a normal user and root user in Linux?
Below steps are validated on Red Hat Enterprise Linux 7.Auto-logout functionality is mostly used to logout a user if the session is idle for a while. Using this article you should be able to set...
View ArticleHow to save %pre installation log file after installation in Red Hat 7
We intend to write multiple scripts in the %pre and %post section of the kickstart files as per our requirement but since these scripts are executed in the background it is very important that we...
View Article10 Basic examples of SED to perform per line action (print/delete)
In this article I will show you various sed expressions which can be used and combined to print or delete specific line from a fileIMPORTANT NOTE:My examples provided are only to print the action...
View Articlesed: case insensitive actions (search replace delete..)
In this article I will show you different ways to perform an action (as per your requirement) ignoring the case of the letters to be searched in a fileBelow is our sample file[root@golinuxhub ~]# cat...
View Articlesed: 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/fileThis is line oneThis is line twoThis is line threeThis is line four[root@golinuxhub...
View Article