How to extract files from an RPM package on Linux

Question: I downloaded an RPM file (foo.rpm) from somewhere, and I would like to manually extract files from the RPM package. Is there an easy way to extract files from an RPM package without installing it? An RPM package contains a set of files, typically compiled software binaries, libraries, and their development source files. These […]
Continue reading…

 

How to add bookmarks to a PDF document on Linux

Question: I would like to add bookmarks to a PDF file, so that the bookmarks appear in the left hand side bookmarks panel. Is there a command-line approach to create bookmarks and embed bookmark links in a PDF file on Linux? In a PDF document, bookmarks can be added as a navigational tool to allow […]
Continue reading…

 

How to install Newsbeuter command-line RSS reader on Linux

Question: I want to try Newsbeuter RSS reader. How can I install Newsbeuter on [Debian, Ubuntu, CentOS, Fedora or RHEL]? Newsbeuter is a command-line RSS feed reader designed to access RSS/Atom feeds in a terminal environment. Used together with a text-mode web browser such as elinks, lynx or w3m, Newsbeuter allows you to read RSS/Atom […]
Continue reading…

 

How to compare two version numbers in a shell script

Question: I am writing a shell script in which I need to compare two version number strings (e.g., “1.2.30” and “1.3.0”) to determine which version is higher or lower than the other. Is there a way to compare two version number strings in a shell script? When you are writing a shell script, there are […]
Continue reading…

 

How to search and replace a multi-line string in a file

Question: I have a text file in which I want to change multiple lines of text to something else, but without using a text editor. Is there a way to find and replace a multi-line string pattern from the Linux command line? Suppose you have a text file that looks like the following. Beginning of […]
Continue reading…

 

How to remove trailing whitespaces in a file on Linux

Question: I have a text file in which I need to remove all trailing whitespsaces (e.g., spaces and tabs) in each line for formatting purpose. Is there a quick and easy Linux command line tool I can use for this? When you are writing code for your program, you must understand that there are standard […]
Continue reading…