How to find network card driver name and version on Linux

Question: An Ethernet network interface card is attached to my Linux box, and I would like to know which network adapter driver is installed for the NIC hardware. Is there a way to find out the name and version of a network card driver for my network card? For network interface card (NIC) hardware to […]
Continue reading…

 

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 detect the type of virtualization from the command line

Question: I am trying to write a shell script in which I need to detect whether the Linux server on which the script is running is a virtual machine, a container or actual bare-metal hardware. This is because the script should perform different tasks depending on whether the underlying server is virtual or physical. Is […]
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 check weather forecasts from the command line on Linux

Question: I often check local weather forecasts on the Linux desktop. However, is there an easy way to access weather forecast information in the terminal environment, where I don’t have access to desktop widgets or web browser? For Linux desktop users, there are many ways to access weather forecasts, e.g., using standalone weather apps, desktop […]
Continue reading…

 

How to compress JPEG images from the command line on Linux

Question: I have several JPEG photo images I have taken using a digital camera. I would like to optimize and compress the JPEG pictures before uploading them to Dropbox. What is the easiest way to compress JPEG images without losing their quality on Linux? Image resolution of today’s picture taking gadgets (e.g., smartphones, digital cameras) […]
Continue reading…

 

How to crop an image from the command line on Linux

Question: I would like to get rid of white margins of an image file. Is there an easy way to crop an image file from the command line on Linux? When it comes to converting or editing images files on Linux, ImageMagick is undoubtedly one of the best known all-in-one image software. It boasts of […]
Continue reading…

 

How to change date and time from the command line on Linux

Question: In Linux, how can I change date and time from the command line? Keeping the date and time up-to-date in a Linux system is an important responsibility of every Linux user and system administrator. Many applications rely on accurate timing information to operate properly. Besides, inaccurate date and time render timestamp information in log […]
Continue reading…

 

How to display JSON string in a human readable format on Linux

Question: I have JSON-formatted string. Is there a quick and easy way to display JSON string in a human readable format, preferably from the command line on Linux? When you are developing a web application, you may often deal with JSON-formatted input/output. When you are inspecting such JSON-formatted data, you may want to see it […]
Continue reading…