Learn how to get the compressed data in a byte array when using the GZIP file format.
Also find me here:
Baeldung Editor
Saajan Nagendra
Saajan is an architect with deep experience building systems in several business domains. With a clean and minimalist approach to design, he is passionate about code – the aesthetics of it, and creating maintainable and flexible solutions. He enjoys both sharing with and learning from others.
Here's what I've reviewed (so far):
Baeldung on Java
- All
- Java (25)
- Core Java (20)
- Testing (17)
- Java String (15)
- Spring (11)
- Security (9)
- REST (9)
- Java Numbers (9)
- Java Concurrency (9)
- Java Collections (9)
- Spring Boot (8)
- Java Dates (8)
- Data (8)
- Persistence (7)
- Java Streams (7)
- Java IO (7)
- Jackson (7)
- Spring Security (6)
- Spring Data (5)
- Networking (5)
- Java Array (5)
- Algorithms (5)
- XML (4)
- NoSQL (4)
- Maven (4)
- Logging (4)
- Gradle (4)
- Web Services (3)
- Spring MVC (3)
- Java Web (3)
- Java Map (3)
- Jakarta EE (3)
- JVM (3)
- JPA (3)
- DevOps (3)
- Spring Web (2)
- Reactive (2)
- JSON (2)
- Spring Persistence (1)
- Spring Cloud (1)
- HTTP Client-Side (1)
- Guava (1)
- Groovy (1)
- Docker (1)
- Artificial Intelligence (1)
- Architecture (1)
Callbacks in ListenableFuture and CompletableFuture
Filed under Java Concurrency
Learn all about the callback mechanisms in ListenableFuture and CompletableFuture.
Get Index of First Element Matching Boolean Using Java Streams
Filed under Java Collections, Java Streams
Learn how to use the Java Stream API and third-party libraries to find the index of the first element in a List that matches a boolean condition.
How to Parse XML to HashMap in Java
Learn different ways to parse XML into a HashMap, a data structure that allows for efficient data retrieval and manipulation.
Differences Between * and ? in Cron Expressions
Filed under Java
Learn the differences between the asterisk and the question mark special characters in cron expressions.
Representing Furthest Possible Date in Java
Filed under Java Dates
Learn how to represent the furthest possible date using the java.util.Date and java.lang.Long classes.
Create Table Using ASCII in a Console in Java
Filed under Java
Learn how to use the Java standard API and a third-party API to create a table using ASCII characters in Java.
Why Is sun.misc.Unsafe.park Actually Unsafe?
Filed under Java Concurrency
Learn why Unsafe.park() is actually unsafe and get an insight into the interworking of the park() and unpark(Thread) methods.
Switching Between Frames Using Selenium WebDriver in Java
Filed under Testing
Explore a few distinct methods to switch between frames with Selenium WebDriver.
Add a List as Query Parameter in Jersey
Filed under Jakarta EE
Explore different ways to add a list as a query parameter when making requests using the Jersey client.
Working With MathFlux
Explore the MathFlux module from Project Reactor and learn how to execute various mathematical operations on reactive streams.
Intro to Vector Class in Java
Filed under Java Collections
Learn about the Vector class and explore some of its most common operations and methods.
Optional as a Record Parameter in Java
Filed under Core Java
Learn about using Optional as a record parameter and understand why it’s a bad practice.
How to Document Generic Type Parameters in Javadoc
Filed under Java
Explore best practices for using the @param tag to document generic type parameters.
JNDI – What Is java:comp/env?
Filed under Jakarta EE
Understand the reasoning behind using the “java:comp/env” standard prefix in JNDI naming.
PrintWriter vs. FileWriter in Java
Filed under Java IO
Learned the basic usage of FileWriter and PrintWriter with example code and understand their differences.
Convert From List of CompletableFuture to CompletableFuture List
Filed under Java Collections, Java Concurrency
Learn how to convert from a List of CompletableFuture to a CompletableFuture of List.
How to Convert an Object to String
Filed under Java String
Explore various techniques for converting an object to its string representation in Java.
Configuring the GlassFish Server in Eclipse
Filed under Java Web
Learn step-by-step how to setup a GlassFish server within the Eclipse IDE.
Drawbacks of the Singleton Design Pattern
Filed under Java
Learn the general drawbacks of the Singleton design pattern and check out some alternatives.
Difference Between Information Hiding and Encapsulation
Filed under Core Java
Understand the key differences between encapsulation and information hiding.
Trunk-Based Development
Filed under DevOps
Learn about the trunk-based development approach and understand how it differs from the feature branch development model.
Unnamed Classes and Instance Main Methods in Java 21
Filed under Core Java
Learn about the unnamed classes and instance main methods in Java 21.
Testing Interface Contract in Java
Filed under Testing
Explore several ways of writing JUnit tests to validate interface contracts in Java.
Increment Character in Java
Filed under Java Streams
Learn how to generate a sequence of characters from ‘A’ to ‘Z’ in Java.
Code Snippets in Java API Documentation
Filed under Java
Explore how to add code snippets into documentation using the @snippet tag.
A Guide to Log4j and the log4j.properties File in Java
Filed under Logging
Learn about Log4j and how to configure the core components using the log4j.properties file in Java.
Log4j 2 Configuration Using a Properties File
Filed under Logging
Learn about Log4j 2, its benefits over Log4j, and how to configure its core components using the log4j2.properties file in Java.
Double Precision Issue in Java
Filed under Java Numbers
Learn what the double precision issue is, how it affects code, and how to deal with it.
Detect EOF in Java
Filed under Java IO
Explore several methods for detecting the end-of-file character in Java.
Securing Spring Boot 3 Applications With SSL Bundles
Filed under Spring Boot, Spring Security
Explore the new SSL Bundles feature of Spring Boot 3 and learn how it can streamline SSL configuration tasks for Spring Boot applications.
Intro to Gradle Lint Plugin
Filed under Gradle
Learn how to configure the lint plugin and generate lint reports.
Add Minutes to a Time String in Java
Filed under Java Dates, Java String
Learn how to add minutes to a time in the string format using the legacy Date API and the Date Time API.
Query With IN Clause in Spring Data Cassandra
Filed under Spring Data
Learn how to implement the IN query clause using Spring Data Cassandra.
Differences Between Heap Dump, Thread Dump and Core Dump
Filed under JVM
Learn the differences between heap dump, thread dump, and core dump and understand their use cases.
Stop Executing Further Code in Java
Filed under Core Java
Explore multiple programmatic ways to stop the execution of further code in Java programs.
Clamp Function in Java
Filed under Java
Learn three different methods to implement the clamp function in Java.
Reading JSON Documents as Maps and Comparing Them
Filed under Jackson
Learn different ways to read JSON documents as Maps and compare them.
Check if Certificate Is Self-Signed or CA-Signed With Java
Filed under Security
Learn how to determine if a certificate is self-signed or signed by a trusted Certificate Authority (CA).
Generate Models Using OpenAPI With Lombok Annotations
Filed under REST
Learn how to generate a model with Lombok annotations using the OpenAPI code generator.
Calculate Distance Between Two Coordinates in Java
Filed under Algorithms
Learn three methods to calculate the distance between two geographical coordinates in Java.
Programmatic Generation of JSON Schemas in Java
Learn how to create JSON Schemas programmatically using the Java JSON Schema Generator library.
Executing SQL Script File in Java
Filed under Persistence
Learn about the database utilities provided by MyBatis and Spring JDBC to execute SQL files.
Conversion From 12-Hour Time to 24-Hour Time in Java
Filed under Java Dates
Learn two different ways to convert time from the 12-hour time format to the 24-hour time format in Java.
What Does the Holder<T> Class Do in Java?
Filed under Core Java
Learn how the Holder class can serve as a flexible and powerful tool for various programming scenarios in Java.
Convert JSON Array to Java List
Filed under Jackson
Learn how to convert a JSON array to a Java List using the popular Gson and Jackson libraries.
How to Get the Start and End Dates of a Year Using Java
Filed under Java Dates
Learn how to get the start and end dates of a year using the modern Date Time API and the old Calendar and Date classes.
Law of Demeter in Java
Filed under Java
Learn about the Law of Demeter and understand how to adhere to it in object-oriented code.
Unit Testing of System.in With JUnit
Filed under Testing
Learn how to test user input scenarios using System.in with JUnit 4 and JUnit 5.
What Is the Maximum Depth of the Java Call Stack?
Learn how to determine the maximum depth of the Java call stack.
New Features in Java 20
Filed under Core Java
Explore some of the new features and changes introduced as part of the incremental Java 20 release.
Does Java Read Integers in Little Endian or Big Endian?
Filed under Java Numbers
Understand the specifics of how Java reads integers and whether it follows the Little or Big Endian approach.
Integer.class vs Integer.TYPE vs int.class
Filed under Java Numbers
Explore the differences between Integer.class, Integer.TYPE, and int.class. Understand their significance in Java programming.
Documenting Spring Event-Driven API Using AsyncAPI and Springwolf
Filed under Spring Boot
Learn how to document event-driven Spring Boot services using Springwolf.
Reading a JSP Variable From JavaScript
Filed under Java Web
Explore several approaches to accessing a JSP variable from JavaScript.
How to Solve 403 Error in Spring Boot POST Request
Filed under REST, Spring Boot
Learn how to solve the 403 error in a Spring Boot POST request.
Difference Between @JoinColumn and @PrimaryKeyJoinColumn in JPA
Filed under JPA
Learn the difference between @JoinColumn and @PrimaryKeyJoinColumn in Java Persistence API (JPA).
Parallelize for Loop in Java
Filed under Java Concurrency
Learn different ways to parallelize a for loop in Java.
Smart Batching in Java
Filed under Java
Learn about task batching techniques in Java and understand how the smart batching technique can help address the shortcomings of micro batching.
Lombok’s @RequiredArgsConstructor Annotation
Filed under Java
Learn how the @RequiredArgsConstructor annotation of Lombok can help auto-generate constructors for classes.
JAXP vs JAXB: XML Processing APIs Compared
Filed under XML
Learn the differences between JAXP and JAXB in Java and understand when to use which.
Convert Java Array to Iterable
Filed under Java Array
Explore several approaches to convert a Java array to an Iterable collection.
Hex Representation of a SHA-1 Digest of a String in Java
Filed under Algorithms, Security
Learn three different ways to generate the hex representation of a SHA-1 digest of a string in Java.
Asserting Equality on Two Classes Without an equals() Method
Filed under Testing
Learn a few ways of testing for the equality of two objects without the equals() method.
Java IllegalStateException: “getInputStream() has already been called for this request”
Filed under Jakarta EE, Java Web
Learn what causes IllegalStateException when we call the ServletRequest.getReader() method in a Java web application and understand how to fix it.
Run JMeter .jmx File From the Command Line and Configure the Report File
Filed under Testing
Learn how to run JMeter JMX files from the command line and configure the report file.
Generating WSDL Stubs With Gradle
Filed under Gradle, Web Services
Learn how to generate WSDL stubs with Gradle and use the generated stub classes.
Combining Two or More Byte Arrays
Filed under Java Array
Explore multiple ways to concatenate two or more byte arrays.
Why Is Field Injection Not Recommended?
Filed under Spring
Understand why field injection isn’t recommended and what alternative approaches we can use.
Mocking Private Fields With Mockito
Filed under Testing
Explore how to mock private fields with Mockito.
How to Display a Full HTTP Response Body With Gatling
Filed under Testing
Learn how to display on the console the full HTTP response body with Gatling.
Read Data From the Beginning Using Kafka Consumer API
Filed under Data
Learn how to read data from the beginning of a Kafka topic using the Kafka Consumer API.
Is a Key Required as Part of Sending Messages to Kafka?
Filed under Data
Understand the significance of a key in a Kafka message and learn how to publish messages with a key to a Kafka topic.
Converting JSON to XML in Java
Learn how to convert JSON to XML in Java.
Generating Javadoc With Gradle
Filed under Gradle
Learn how to generate Javadoc using the Gradle build system.
Custom WebFlux Exceptions in Spring Boot 3
Filed under REST, Spring Boot
Learn about the ProblemDetail RFC7807 exception format provided by the Spring Framework and how to create and handle custom exceptions in Spring WebFlux.
Working With Empty Stream in Java
Filed under Java Streams
Understand intermediate and terminal operations in Java Streams and learn how to create and check for an empty Stream.
Hashing With Argon2 in Java
Filed under Security
Learn about hashing and salting techniques and understand how to hash with Argon2 in Java.
Should We Create an Interface for Only One Implementation?
Filed under Architecture
Explore the practical implications of creating an interface for a single implementation in Java and understand the pros and cons of this approach.
Difference Between null and Empty String in Java
Filed under Java String
Learn how “null” and empty strings behave in different scenarios.
Converting an AAR File to a JAR File
Filed under Java
Learn the steps to convert an AAR file to a JAR file.
Lombok EqualsAndHashCode Annotation
Filed under Java
Learn about Lombok’s @EqualsAndHashCode annotation, which generates the equals() and hashCode() methods for a class based on its fields.
Uploading File Using Selenium Webdriver in Java
Filed under Testing
Learn how to upload files using Selenium WebDriver.
Generate UUIDs as Primary Keys With Hibernate
Filed under JPA
Learn how to use Hibernate and JPA to generate UUIDs for your entities.
Add Custom Headers to a Kafka Message
Filed under Data
Learn how to use a Kafka producer to add custom headers in a Kafka message.
Is CompletableFuture Non-blocking?
Filed under Java Concurrency
Understand the scenarios when CompletableFuture is non-blocking and when it’s not.
Find the Index of an Element in a Java Array
Filed under Java Array
Learn various methods for finding the index of an array element using both Java’s built-in APIs and a third-party library.
Retrieve the Value of an HTML Input in Selenium WebDriver
Filed under Testing
Learn how to set up a Selenium project and retrieve the value of an HTML input field from a web page.
Boolean Converters in Hibernate 6
Filed under Persistence
Learn how to map boolean properties in the domain model using boolean converters added in Hibernate 6.
JAVA_HOME vs PATH Environment Variables
Filed under Java
Explore the differences between using the JAVA_HOME and PATH environment variables.
Creating a Test Suite With JUnit
Filed under Testing
Learn two different ways for creating test suites with JUnit.
A Guide to FlexyPool
Filed under Spring Boot, Spring Persistence
Learn learn how to use FlexyPool with Spring Boot and H2 using the HikariCP connection pool.
Difference Between th:text and th:value in Thymeleaf
Filed under Spring MVC
Understand the differences between the th:text and th:value Thymeleaf attributes.
Overview of NLP Libraries in Java
Filed under Artificial Intelligence
Explore different NLP libraries in Java and see how to implement some NLP tasks using Apache OpenNLP and Stanford CoreNLP.
Guide to Swagger Parser
Filed under REST
Learn how to parse an OpenAPI document file in Java and extract its various components.
Convert Integer to Hexadecimal in Java
Filed under Java Numbers
Learn how to convert an integer value to hexadecimal in Java.
Java Program to Estimate Pi
Filed under Algorithms
Learn how to estimate the value of pi using the Monte Carlo algorithm in Java.
Search Users With Keycloak in Java
Filed under Security
Learn how to search for and manage users with Keycloak in Java.
OffsetDateTime Serialization With Jackson
Filed under Jackson, Java Dates
Learn how to serialize and deserialize OffsetDateTime with Jackson in Java.
Testing Spring OAuth2 Access-Control
Filed under Spring Security
Explore options for testing Spring OAuth2 access control rules with mocked identities.
Managing Multiple JDK Installations With jEnv
Learn how to manage multiple different versions of JDK installations using jEnv.
Guide to Java Project Panama
Filed under Java
Project Panama aims to ease the interaction between Java and foreign (non-Java) APIs, i.e., native code written in C, C++, etc.
Download a Webpage in Java
Filed under HTTP Client-Side, Java, Networking
Learn how to download a webpage in Java using Jsoup and HttpURLConnection.
Finding All Duplicates in a List in Java
Filed under Java Collections
Learn different ways of extracting duplicate elements from a List in Java.
Introduction to Roaring Bitmap
Filed under Java
Learn about the roaring bitmap data structure, understand some of its operations, and see how it performs compared to BitSet.
Database Keywords as Columns in Hibernate Entities
Filed under Persistence
Learn how to avoid cryptic Hibernate exceptions by properly escaping database keywords in column names.
Migrate From Java 8 to Java 17
Filed under Java
Explore some extremely useful features available in the newer versions of Java. These features aren’t only easy to learn but can also be implemented quickly without much effort when planning to migrate from Java 8 to Java 17.
Mapping an Array of Integers to Strings Using Java Streams
Filed under Java Streams
Learn how to use Java Streams to convert arrays of Integers or primitive integers into strings.
Thread.sleep() vs Awaitility.await()
Filed under Java Concurrency
Learn two different approaches for handling asynchronous operations in Java.
javax vs. java Package
Filed under Core Java
Explore examples of both java and javax packages and understand the key differences between them.
Find the First Embedded Occurrence of an Integer in a Java String
Filed under Java String
Learn different techniques to extract the first embedded integer from a String.
Convert Hex to RGB Using Java
Filed under Java
Learn how to convert a hex color code to an equivalent RGB value in Java.
Getting the Current ApplicationContext in Spring
Filed under Spring
Learn how to get the current ApplicationContext in a Spring application.
Reading PDF File Using Java
Filed under Java IO
Learn two different ways of reading PDF files in Java using the popular Apache PDFBox and iText libraries.
Memory Types in JVM
Filed under JVM
Learn about the different memory types in the Java Virtual Machine (JVM) and understand the reasons for some common memory-related errors.
Stream to Iterable in Java
Filed under Java Streams
Learn different ways for using a Stream as an Iterable.
Java HttpClient – Map JSON Response to Java Class
Learn four ways to map JSON responses to a POJO class when using Java HttpClient.
Check if Command-Line Arguments Are Null in Java
Filed under Core Java
Learn a few techniques for checking if the command-line arguments are missing in a Java program.
Differences Between Spring Data JPA findFirst() and findTop()
Filed under Spring Data
Learn about the findFirst() and findTop() methods from Spring Data JPA.
Compiling and Executing Code From a String in Java
Filed under Java String
Learn how to turn a String containing Java source code into a compiled class and then execute it.
Batch Processing of Stream Data in Java
Filed under Guava, Java Streams
Explore how to accomplish batch processing of Stream data in Java using both native features and some third-party libraries.
Spring MVC – Mapping the Root URL to a Page
Filed under Spring MVC
Learn how to map the root URL to a page in Spring MVC.
@JsonIgnore vs @Transient
Learned the differences between the @JsonIgnore and @Transient annotations and understand when to use them.
RESTful Microservices With RestExpress
Learn how to create a REST API using the open-source RestExpress framework.
Lightweight Logging With tinylog 2
Filed under Logging
Learn the fundamental logging methods and configuration parameters of the tinylog 2 logging framework and understand how to issue log entries.
Encoding of URI Variables on RestTemplate
Filed under Spring Boot, Spring Web
Learn two methods for encoding URI variables on Spring’s RestTemplate.
Working With Multiple Repositories in Gradle
Filed under Gradle
Learn how to use libraries from multiple repositories when working on a Gradle project and how to use GitHub Package Registry for authenticated repositories.
Check JWT Expiry Without Throwing Exceptions
Filed under Security
Understand the difference between verifying a JWT and decoding a JWT and learn how to check for a JWT’s expiry without throwing any exceptions.
When to Use Callable and Supplier in Java
Filed under Core Java
Learn the differences between Callable and Supplier interfaces and understand when to use them.
Sorting a HashSet in Java
Filed under Java Collections
Learn multiple techniques to sort the elements of a HashSet.
Convert Between int and char in Java
Filed under Core Java
Learn how characters are internally represented in Java and how we can convert an int to a char and back.
Managing JWT With Auth0 java-jwt
Filed under Security
Learn how to create and decode a JSON Web Token using the Auth0 JWT Java Library.
Reinitialize Singleton Bean in Spring Context
Filed under Spring
Learn multiple ways to reinitialize singleton Spring beans at runtime.
MongoDB vs. Couchbase
Filed under NoSQL
Explore the similarities and differences between MongoDB and Couchbase in terms of the architecture, features, data model, and more.
Convert Between LocalDateTime and ZonedDateTime
Filed under Java Dates
Learn how to convert an instance of LocalDateTime to ZonedDateTime and vice versa.
Uses for Optional in Java
Filed under Core Java
Understand the purpose of the Optional class and learn how to use it efficiently to design clear and robust APIs.
Expression Types in Thymeleaf
Filed under Spring MVC
Learn the different expression types available in Thymeleaf with examples.
Access HTTPS REST Service Using Spring RestTemplate
Filed under REST, Security, Spring Security
Learn how to consume a REST service secured with HTTPS using Spring’s RestTemplate.
Sort Collection of Objects by Multiple Fields in Java
Filed under Java Collections
Learn different approaches for sorting collections by comparing multiple fields.
SpringRunner vs MockitoJUnitRunner
Filed under Testing
Learn the key differences between SpringRunner and MockitoJUnitRunner and understand their purpose.
Retain Only Digits and Decimal Separator in String
Filed under Java String
Explore four approaches for removing all non-numeric characters from a Java String while keeping the decimal separator.
Fixing Selenium WebDriver Executable Path Error
Filed under Testing
Understand what causes the Selenium error “The path to the driver executable must be set by the webdriver.chrome.driver system property” and learn how to fix it.
Mocking a Singleton With Mockito
Filed under Testing
Learn a few ways to write unit tests for singletons using Mockito.
Guide to Filters in MongoDB
Filed under NoSQL
Learn how to use Filters builders to perform filter operations on a MongoDB collection.
JUnit – Testing Methods That Call System.exit()
Filed under Testing
Learn techniques for testing methods that call System.exit() when using JUnit.
Using Groovy in Spring
Explore the Spring framework’s extensive support for Groovy and learn how to create bean definitions using different approaches.
Gravity/Bead Sort in Java
Filed under Algorithms
Learn about the gravity sort (a.k.a. bead sort) algorithm and understand its single-threaded implementation in Java.
Message Delivery Semantics in Streaming Platforms
Filed under Data
Learn the differences between the three delivery semantics used in streaming platforms and how to obtain these guarantees in Apache Kafka.
Guide to Simple Binary Encoding
Learn about Simple Binary Encoding (SBE): how to set it up, define the message structure via XML, and use it for messages in Java.
Validating URL in Java
Filed under Networking
Learn two different methods for validating a URL in Java.
Difference Between Java Enumeration and Iterator
Filed under Java Collections
Learn the differences between Enumeration and Iterator in Java.
Difference Between Flux and Mono
Filed under Reactive
Learn the difference between Flux and Mono of the Reactor Core library.
Using HAProxy as an API Gateway for Routing and Rate Limiting
Filed under DevOps, Networking
Learn how to use HAProxy as an API Gateway for routing and rate limiting.
Convert a List to a Comma-Separated String
Filed under Java Collections
Learn four ways to convert a List of Strings to a comma-separated String.
Create a BMI Calculator in Java
Filed under Algorithms
Learn how create your own BMI Calculator in Java.
Constructing a Relative Path From Two Absolute Paths in Java
Filed under Java IO
Learn how to construct a relative path from two absolute paths in Java.
Define an Array of Varying Types in OpenAPI
Filed under REST
Learn how to define an array of varying types using the OpenAPI Specification.
Log4j2 – Logging to Both File and Console
Filed under Logging
Explore how to log messages to both file and console using the Apache Log4j2 library.
Get the Number of Messages in an Apache Kafka Topic
Filed under Data
Learn a few techniques for getting the number of messages in a Kafka topic.
Display Logged-in User’s Information in Thymeleaf
Filed under Spring Security
Learn how to display the logged-in user’s information in Thymeleaf using Spring Security’s support in a Spring Boot application.
Testing Spring JMS
Learn different approaches for testing a Spring JMS application.
Apply Default Global SecurityScheme in springdoc-openapi
Filed under Spring
Learn how to use springdoc-openapi to define a default global security scheme and apply it as the default security requirement of the API.
Spring Boot – Testing Redis With Testcontainers
Filed under Spring Boot, Testing
Learn how to use Testcontainers while testing a Spring Boot application that uses Redis.
Advantages and Disadvantages of Using Java Wildcard Imports
Filed under Core Java
Learn the advantages and disadvantages of using wildcard import statements in Java.
Instantiating Multiple Beans of the Same Class with Spring Annotations
Filed under Spring
Learn three different approaches for instantiating multiple beans of the same class using Spring annotations.
How to Convert InputStream to Base64 String
Filed under Java IO, Java String
Learn how to use Java Streaming IO functions and the built-in Base64 class to load binary data as an InputStream and then convert it to a String.
Check if a Number Is Odd or Even in Java
Filed under Java Numbers
Learn multiple ways to check the parity of a number in Java.
Spring Data JPA – Run an App Without a Database
Filed under Spring Data
Learn how to start a Spring Boot application without having a running database when using Spring Data JPA.
How to Calculate “Time Ago” in Java
Filed under Java Dates
Explore several solutions for calculating “time ago” in Java.
Difference Between Java SE/EE/ME
Filed under Java
Learn about the three different Java Editions, understand what functionalities they provide and their typical use cases.
Difference Between parseInt() and valueOf() in Java
Filed under Java Numbers
Learn the differences between the parseInt() and valueOf() methods of the java.lang.Integer class in Java.
Disabling Keycloak Security in Spring Boot
Filed under Spring Security
Learn how to disable the configuration put in place by the Spring Keycloak starter.
Sending CSRF Token From Postman REST Client
Filed under Web Services
Learn how to automate the sending of the CSRF token to the server when using Postman.
How to Mock HttpServletRequest
Learn multiple ways to mock a HttpServletRequest object when unit testing Servlet code in Java.
Difference Between Thread’s Context Class Loader and Normal Class Loader
Filed under Core Java
Explore the difference in the behavior of current and thread class loaders in Java.
Introduction to Spring Cloud Sidecar
Filed under Spring Cloud
Learn about Spring Cloud Sidecar and how to take advantage of Spring Cloud in a microservice world having polyglot services written with different languages and frameworks.
Converting a JDBC ResultSet to JSON in Java
Filed under Persistence
Learn three different ways to convert a JDBC ResultSet to a JSON object.
Reverse a Number in Java
Filed under Java Numbers
Learn how to reverse a number using a mathematical approach in Java.
Differences Between Iterator and Iterable and How to Use Them?
Filed under Java Collections
Explore the usage of Iterable and Iterator interfaces in Java and understand the differences between them.
Java HttpClient With SSL
Filed under Networking
Learn how to use the Java HttpClient to connect to HTTPS URLs and also find out how to bypass certificate verification in non-production environments.
Differences Between set() and lazySet() in Java Atomic Variables
Filed under Java Concurrency
Learn the differences between set() and lazySet() methods of atomic classes in Java and understand when to use which method.
Difference Between == and equals() in Java
Filed under Core Java
Learn about the reference and value equality checks in Java, the differences between them, and understand when to use which check.
Check Whether a String Is Valid JSON in Java
Filed under Java String
Learn multiple ways to check whether a Java String is valid JSON.
How to Disable a Maven Plugin Defined in a Parent POM
Filed under Maven
Learn a couple of different approaches to disabling a Maven plugin defined in a parent POM.
Get the IP Address of the Current Machine Using Java
Filed under Networking
Learn various methods to retrieve the local and public IP addresses of the current machine using Java.
Return Map from GraphQL
Filed under Web Services
Learn three different techniques to return a Map object from a GraphQL query.
How Does the Spring Singleton Bean Serve Concurrent Requests?
Filed under Java Concurrency, Spring
Learn how Spring beans created with the singleton scope work behind the scenes to serve multiple concurrent requests.
The for-each Loop in Java
Filed under Core Java
Learn all about the the for-each loop in Java – its syntax, benefits and drawbacks, and examples.
A Guide to @DBRef in MongoDB
Filed under Spring Data
Learn how to use Spring Data MongoDB’s @DBRef annotation to connect related documents.
Difference Between POJO, JavaBeans, DTO and VO
Filed under Java
Learn what Data Transfer Object (DTO), Value Object (VO), Plain Old Java Object (POJO), and JavaBeans are. Understand the differences between them and when to use each type.
Automorphic Numbers in Java
Filed under Java Numbers
Understand what an automorphic number is and learn a couple of approaches in Java to determine if a number is automorphic.
Secondary Indexes in Cassandra
Filed under NoSQL
Learn how to use secondary indexes in Apache Cassandra and also understand some best practices and recommendations.
Lombok’s @ToString Annotation
Filed under Java
Learn how to auto-generate the toString() method using Lombok annotations and the various configuration options available to further fine-tune the resulting output.
Finding the Last Row in an Excel Spreadsheet From Java
Filed under Java IO
Learn how to find the last row in an Excel spreadsheet using Java and Apache POI.
What Is an Apache Maven Artifact?
Filed under Maven
Learn what a Maven artifact is and get an understanding of coordinates, dependency management, and repositories.
How to Create a New Entry in a Map
Filed under Java Map
Learn how to use Java’s built-in classes, third-party libraries, and a custom implementation to create an Entry object in a Map.
A Guide to Maven Artifact Classifiers
Filed under Maven
Learn about artifact classifiers in Maven and understand the various scenarios where they are useful.
Check if a User Is Logged-in With Servlets and JSP
Filed under Security
Learn how to use Servlets and JSPs to ensure a user is authenticated and has started a valid session before accessing any resources.
Hibernate’s addScalar() Method
Filed under Persistence
Learn the uses of the addScalar() method in Hibernate, how to use it and when to use it, along with examples.
How to use JNI’s RegisterNatives() method?
Filed under Core Java
Learn how to use the JNI RegisterNatives() method, why it’s useful, and what the java.lang.Object.registerNatives() method does under the hood.
Java ArrayIndexOutOfBoundsException
Filed under Java Array
Learn what causes ArrayIndexOutOfBoundsException in Java and common techniques to avoid it.
Setting Example and Description with Swagger
Learn how to use Swagger annotations to make documentation more descriptive and readable.
Remove Basic Error Controller In SpringFox Swagger-UI
Filed under Spring Boot
Learn multiple ways to configure Swagger in a Spring Boot application to hide paths exposed by the BasicErrorController.
Get Last Inserted Document ID in MongoDB With Java Driver
Filed under NoSQL, Persistence
Learn about MongoDB document IDs and how to retrieve the ID of a document we just inserted in a collection via a Java program.
How to Access EntityManager with Spring Data
Filed under Spring Data
Learn how to access the EntityManager directly when working on a Spring Data application.
Cassandra Batch in Cassandra Query Language and Java
Filed under Data
Learn about the Cassandra batch query and how to apply it in Cqlsh and Java using BatchStatement.
An Introduction to InstantSource in Java 17
Filed under Java Dates
Learn all about the InstantSource interface introduced in Java 17. Understand what problems it addresses, and how to use it.
String equals() Vs contentEquals() in Java
Filed under Java String
Learn the differences between the equals() and the contentEquals() methods of the String class in Java using practical examples.
Volatile Variables and Thread Safety
Filed under Java Concurrency
Learn why declaring a shared variable as volatile does not always guarantee thread-safety.
Guide to Netflix Spectator
Filed under Data
A guide to Spectator, a library from Netflix for metrics measurement. Learn what features it provides and how to use it to collect metrics.
Content Security Policy with Spring Security
Filed under Spring Security
Learn how to mitigate code injection risks in Spring Security-based web applications using the Content-Security-Policy headers
Remove Duplicate Dependencies with Maven
Filed under Maven
Learn how to detect duplicate dependencies in Maven using the mvn dependency:tree and mvn dependency:analyze-duplicate commands.
Lombok Using @With Annotations
Filed under Java
Learn how to make copies of immutable objects with changes to only a single property using Lombok.
Concatenating Null Strings in Java
Filed under Java String
Learn various approaches to avoid null String objects while concatenating Strings in Java.
Java Classpath Syntax in Linux vs. Windows
Filed under Core Java
Learn how to set the Java classpath on different operating systems and what to watch out for.
Declaring Val and Var Variables in Lombok
Filed under Java
Learn how to use Lombok’s val and var to define local variables without specifying the type.
Compare Strings While Ignoring Whitespace in Java
Filed under Java String
Learn different ways to compare strings while ignoring whitespace in Java.
Ignoring Commas in Quotes When Splitting a Comma-separated String
Filed under Java String
Learn various approaches for ignoring commas in quotes when splitting a comma-separated String.
What Is OncePerRequestFilter?
Filed under Spring Web
Learn how to use the Spring OncePerRequestFilter to ensure your filter code is executed only once for each request.
Split a String Only on the First Occurrence of Delimiter
Filed under Java String
Learn two approaches to split a String only on the first occurrence of a delimiter in Java.
What Is the –release Option in the Java 9 Compiler?
Filed under Core Java
Learn about Java 9’s new command-line compiler option –release, what it does and how to use it.
Getting Started With Apache Derby
Filed under Persistence
A quick guide to the Apache Derby open-source relational database engine, this article discusses all the major aspects from installing and configuring it to working with its various tools. It also shows how we can connect to it programmatically using plain JDBC and in a Spring Boot application.
Java Map – keySet() vs. entrySet() vs. values() Methods
Filed under Java Map
Learn how to use the keySet(), entrySet() and values() methods of the Map interface in Java.
Getting a Character by Index From a String in Java
Filed under Java String
Learn how to get the character at a given position of a String in Java.
Pattern Matching for Switch
Filed under Core Java
This article is a deep dive into pattern matching for switch statements, a preview feature in Java 17.
Remove Accents and Diacritics From a String in Java
Filed under Java String
This article explains what Unicode text normalization is, how to remove accents and diacritical marks in text, and the pitfalls to watch out for.
Convert a Byte Array to a Numeric Representation in Java
Filed under Java Numbers
Explore different approaches to convert a byte array to a numeric value and vice versa in Java.
Snapshotting Aggregates in Axon
Filed under Data
Learn about aggregate snapshotting in event sourcing and how to implement it with Axon Framework.
Connect to Apache Kafka Running in Docker
Filed under Docker
Learn how to configure the listeners in Kafka and allow clients to connect to a broker running within Docker.
Collecting Stream Elements into a List in Java
Filed under Java Streams
Learn how to collect Stream elements into a List in different versions of Java, and the pros and cons of the approaches.
Enabling Unlimited Strength Cryptography in Java
Filed under Security
Learn why and how to enable unlimited strength cryptography in different versions of Java.
Baeldung on Linux
- All
- Scripting (63)
- Administration (63)
- Files (41)
- Networking (31)
- Processes (22)
- Installation (19)
- File Editing (17)
- Security (12)
- File Viewing (9)
- Building (7)
- File Searching (6)
- Filesystems (4)
- File Compression (4)
- Docker (4)
- Web (3)
- File Permissions (3)
- Search (2)
- File Conversion (2)
How to Scale All Images to a Specific Size in Linux
Filed under File Editing, Scripting
Explore various techniques for batch resizing images using ImageMagick’s robust convert tool.
Selecting the Fastest Mirror via Command Line in Ubuntu
Filed under Installation
Explore several command-line methods for determining the fastest apt mirror for Ubuntu.
How to Display a Spinner for Long Running Tasks in Bash
Filed under Scripting
Learn how to display spinners on the terminal during the execution of long-running commands.
Microsoft Paint Alternatives in Linux
Filed under File Editing
Explore seven Linux alternatives to Microsoft Paint and understand their unique features and capabilities.
EPUB Viewer Tools in Linux
Filed under File Viewing
Explore several Linux EPUB viewers, from the feature-rich Calibre to the minimalist FBReader.
How to Delete Old Packages Installed by Package Managers
Filed under Administration, Installation
Learn how to manage and remove orphaned packages in various Linux distributions using different package managers.
IP Spoofing for Testing With cURL on Linux
Filed under Networking
Learn how to perform IP spoofing for testing purposes on Linux using cURL.
Checking and Installing Python Modules in Linux
Filed under Installation
Learn how to check whether a Python module is installed and how to install it if it isn’t.
Getting the Exit Code of a Spawned Process in an Expect Script
Learn how to get the exit code of a spawned process within an Expect script.
High CPU Usage of ksoftirqd Processes
Filed under Processes
Learn what ksoftirqd processes are and why they sometimes consume our CPU capacities.
Find the Largest File in a Directory Recursively
Filed under File Searching, Scripting
Explore several commands and scripts for finding the largest file in a directory recursively.
Get a List of Security Updates in Ubuntu/Debian
Filed under Administration, Installation
Explore several ways to get the list of available security updates on Debian and Ubuntu.
How to Mount a QCOW2 Image in Linux?
Filed under Administration, Filesystems
Learn different methods of mounting QCOW2 image files in a Linux environment.
How to Convert a PDF to a Different Page Size
Filed under File Editing
Learn multiple techniques for changing the page size of a standard PDF file.
The Difference Between the clean and the mrproper Rules
Filed under Building
Learn the difference between the clean and the mrproper rules in the Linux kernel top-level Makefile.
How to Find Installed PHP Extensions on a Linux Machine
Filed under Administration
Learn different methods of finding the installed PHP extensions on a Linux machine.
Running a Script When a Session Is Locked or Unlocked
Filed under Administration, Scripting
Learn how to run a script when a user locks or unlocks a session.
How to Enable Stack Buffer Overflow Protection in Linux?
Filed under Processes
Learn how to activate and deactivate stack-based buffer overflow checks in Linux using gcc and clang-11.
Installing the Dependencies of a Package Without Installing the Package Itself
Filed under Installation
Learn how to install the dependencies of a package using dnf and apt without installing the package itself.
How to Execute a Bash Command in a Python Script
Filed under Scripting
Learn how to call a Bash command in a Python script.
Removing the BOM From a UTF-8 Encoded File
Filed under File Editing
Learn to remove the byte order mark (BOM) from a text file with the UTF-8 encoding scheme.
How to Check the Health of SSD in Linux
Filed under Administration
Learn three methods to test and monitor the health of SSD devices in Linux.
How to Display Date and Time While Pinging in Linux
Filed under Networking, Scripting
Learn how to add timestamps to the output of ping.
Deleting Metadata From Files in Linux
Filed under File Editing
Learn how to use tools like exiftool, exiv2, and ffmpeg for deleting the metadata in different types of files.
Calling MATLAB Functions From the Command Line in Linux
Filed under Scripting
Learn how to call MATLAB functions from the command line and return to the command line automatically.
How to Copy Specific File Type While Keeping the Directory Structure
Filed under Files
Learn different ways to copy specific file types while retaining the directory structure.
How to Unpack, Modify, and Repack a .deb Package
Filed under Administration, Installation
Learn how to use the dpkg-deb tool to unpack, edit, and repack the contents of a .deb package on Debian-based systems.
Crop PDF Files in Linux CLI
Filed under File Editing, Scripting
Learn how to crop single and multi-page PDFs, both automatically and manually, using the Linux command line.
Examples of the Modulo Operator in Bash
Filed under Scripting
Learn how to use the modulo operator in Bash scripting to perform arithmetic operations and assignments.
Using gdb With LD_PRELOAD
Filed under Building
Learn how to use gdb together with the LD_PRELOAD environment variable.
Checking the Details of a POSIX Message Queue
Filed under Processes
Learn how to get the details of a POSIX message queue from the command line.
Generation of Random Integers in a Range in Bash
Filed under Scripting
Learn several methods of generating random numbers within a specific range in Bash.
Differences Between Unix, Linux, BSD, GNU
Filed under Administration
Understand the differences between Unix, Linux, BSD, and GNU, focusing on their history, diversity, practicality, and terminology.
What Is /lib64/ld-linux-x86-64.so.2?
Filed under Building
Learn about the dynamic linker and understand the crucial role it plays in managing the shared library dependencies of a process.
What Is an AppImage?
Filed under Administration, Installation
Learn about AppImage and understand its benefits by going through the step-by-step process of using it.
How to Check Whether a File Is Compressed in Linux
Filed under File Compression, Scripting
Learn how to determine if a file is compressed in one of the classic formats used by compression utilities such as FileRoller, Ark, and others.
Getting Started With KVM Linux
Filed under Administration
Learn about using KVM on Linux systems: from setting up the virtualization environment to running virtual machines with basic settings.
Reading QR Codes in Linux
Filed under Scripting
Learn how to read a QR code from a webcam or a file using some Linux command-line and graphical open-source tools.
Preventing strace From Abbreviating Arguments
Filed under Processes
Learn how to prevent strace from abbreviating the arguments of system calls.
How to Find the Position of a Character in Text
Filed under Search
Learn how to find the position of a character within a text using the grep and awk commands.
Setting up GoogleTest as a Shared Library in Linux
Filed under Installation
Learn how to set up GoogleTest as a shared library in Linux.
How Is the Page Size Determined in Virtual Address Space?
Filed under Administration, Processes
Learn about the virtual memory addressing and pages in Linux and understand how to get the page size.
Conversion of the Output of ls Command to a JSON Array
Learn how to reliably and portably convert the output of ls to a JSON array using Bash scripts.
How to List Available Shells on a Linux Machine
Filed under Administration, Scripting
Explore various methods of finding the available shells on a Linux machine.
Signal Handling in a Multi-Threaded Application in Linux
Filed under Processes
Understand the behavior of a multi-threaded process when we send SIGINT to it and learn how to set up a specific signal handler thread.
Bind Non-root Process to “Privileged” Port on Linux
Filed under Networking
Learn what a privileged port is and understand how to bind a non-root process to a privileged port.
What Are vdso and vsyscall in Linux?
Filed under Processes
Learn about vdso and vsyscall and understand their importance in speeding up system calls for user space applications in Linux.
What Is the Loopback (lo) Device?
Filed under Networking
Learn the main concepts and uses of the loopback interface in Linux.
Installing man Pages Manually
Filed under Administration, Installation
Learn two techniques for installing man pages manually in Linux.
Extracting the Raw Contents of an ELF Section
Filed under Building, File Viewing
Learn how to extract the raw contents of an ELF section, specifically the .text section.
Meaning of 169.254.169.254 on the Cloud
Filed under Networking, Security
Learn the meaning of the IP address 169.254.169.254 within a virtual computer on the cloud.
Passing a Function as a Parameter in Bash
Filed under Scripting
Learn how to declare a function in Bash and pass it as an argument to another function..
Difference Between Building From Source and Installing From a Package File
Filed under Building, Installation
Understand the differences between installing software by building it from source and installing it using a package manager.
Uncompressing a Gzipped File Without Removing It
Filed under File Compression
Learn how to extract the contents of a zipped file without removing it.
How to Add Album Art Cover to Audio Files Using the Command Line
Filed under File Editing
Explore several tools for adding a cover image to an audio file from the Linux terminal.
Changing rpath in an Already Compiled Binary
Filed under Administration, Installation
Understand what rpath is and learn how to change it in an already compiled binary.
UTS Namespaces in Linux
Filed under Networking, Processes
Learn about UTS namespaces and understand how they’re useful in isolating hostnames and domain names.
Verifying if a Disk Is Encrypted in Linux
Filed under Administration, Security
Explore some tools to determine if a mounted partition is encrypted with LUKS.
How to Convert CSV to XLS or XSLX in Linux
Filed under File Conversion
Learn the command-line and GUI approaches to converting CSV data to XLS and XLSX formats.
How ServerName and ServerAlias Work in Apache
Filed under Networking
Learn how to use the ServerName and ServerAlias directives to configure virtual hosts on an Apache web server.
How to Strip Executables in Linux
Filed under Building
Learn how to strip the symbols and debugging information from binaries.
How to Annotate PDF Files in Linux
Filed under File Editing
Explore a few open-source Linux programs for writing annotations over a PDF file, highlighting existing text, or inserting images.
How to Obfuscate a Bash Script to Make It Unreadable
Filed under Scripting
Explore how to obfuscate the code of a Bash script.
How to Sort the Files in a Directory Recursively Based on the Last Modified Date
Filed under File Searching
Explore several methods of recursively sorting files in a directory based on the last modified date.
ICMP Redirect Messages
Filed under Administration, Networking
Learn about ICMP redirect messages and understand whether they should be disabled.
How to Transform a Text File Into a Picture in Linux
Filed under File Viewing
Explore some Linux tools for converting common text formats into PNG raster images or SVG vector images.
Solving the Error “sh: 0: getcwd() failed: No such file or directory”
Learn when the error “sh: 0: getcwd() failed: No such file or directory” occurs, and understand what it means and how to fix it.
Checking ping Statistics Without Stopping Pinging
Filed under Networking
Learn how to get intermediary ping statistics without stopping pinging.
How to Create Virtual Serial Port in Linux
Filed under Administration, Networking
Learn how to use the socat utility and the tty0tty kernel module to create a virtual serial port.
What Is the Purpose of the /dev/zero File?
Filed under Administration, Files
Explore some of the common uses of /dev/zero in Linux.
Does Killing an SSH Session Kill the Programs?
Filed under Administration, Networking
Understand what really happens to running programs when we disconnect an SSH session.
How to Use Google Drive in Linux
Filed under Files, Filesystems
Explore a few CLI and GUI tools to integrate Google Drive with a Linux system and expose a remote directory as a locally mounted folder.
Setting a Password on a PDF File in Linux
Filed under File Permissions, Security
Learn how to set passwords for PDF files using the pdftk and qpdf tools.
Replacing Duplicate Files With Hard Links
Filed under Files
Explore some CLI and GUI tools for automatically replacing files that have identical content with hard links.
LIBRARY_PATH vs LD_LIBRARY_PATH
Filed under Building
Understand with examples the difference between the LIBRARY_PATH and LD_LIBRARY_PATH environment variables.
How to Cause a Linux Kernel Panic From the Terminal
Filed under Administration
Explore a few methods for intentionally causing a kernel panic for testing in a controlled Linux environment.
How to Execute a Shell Script When a USB Device Is Plugged
Filed under Scripting
Learn how to write udev rules to run a script when a USB device is plugged in.
Detecting Who Pings My Computer
Filed under Networking
Explore three different tools in Linux for detecting who is pinging you.
How to Throttle the Download Speed in Bash
Filed under Networking
Learn different ways to limit the download speed in Linux.
How to Stream Video From Webcam to Network Using FFmpeg
Filed under Web
Learn how to use FFmpeg to stream webcam over the most common network protocols.
Converting dmesg Timestamps to Conventional Date and Time Format
Filed under Administration
Learn how to display the timestamps of the kernel messages in a more human-readable format.
Listing the Contents of an RPM Package Without Using the Package File
Filed under Administration, Installation
Learn how to list the contents of a package when the RPM package file is not available.
Getting Notification When systemd Service Fails
Filed under Administration
Learn how to use the systemd OnFailure feature to trigger notifications and how to configure notification channels over Slack and email.
Do File Extensions Have a Meaning in Linux?
Filed under File Viewing
Learn about file extensions and understand how Linux-based systems and programs use mixed techniques to determine file types.
How to Extract “n” Characters Before and After a Match in Shell
Filed under Scripting
Learn how to extract a pattern and the n characters preceding and following it in Bash.
Disabling TCP Offload
Filed under Administration, Networking
Learn about TCP offload in Linux and understand how to disable it.
Read a WebSocket Response in Linux Shell
Filed under Networking, Scripting
Explore a few command-line tools for sending and receiving WebSocket messages in a Linux shell.
Converting Static Libraries to a Shared Library
Filed under Processes
Learn how to convert several static libraries together with object files to a single shared library.
How To Use QEMU From the Linux Command-Line
Filed under Administration, Installation
Learn how to run a Linux distribution as a QEMU guest system using the command-line inside a Linux host.
How to Properly Install Chrome From the Command-Line
Filed under Administration, Installation
Learn how to correctly install Chrome from the command-line on Linux.
How to Add Messages to the Kernel Buffer
Filed under Administration
Learn about the kernel buffer in Linux and explore a few techniques of sending messages to it.
How to Convert CUE, BIN, IMG Images to ISO Images in Linux
Filed under File Conversion
Learn how to convert CUE, BIN, and IMG image formats to the standard ISO-9660 format.
Insert Text at the End of a Group of Lines Using Vim
Filed under File Editing
Learn how to insert text at the end of a group of lines using the command normal in Vim.
How to Call One Shell Script From Another
Filed under Scripting
Learn how to call a script from inside another script and compare the pros and cons of the different ways to do this.
How to Find Files by the Length of the Filename
Filed under File Searching
Explore different methods using various built-in commands to find files based on their filename length.
How to Display Wireless/WiFi Information in Real-time in Linux
Filed under Administration, Networking
Learn different methods for displaying wireless network and driver information.
Breadth-First Search in a Directory
Filed under File Searching
Learn how to list all subdirectories in a directory using a breadth-first search.
IP Address Geolocation Lookups on Linux With GeoLite2
Filed under Administration, Networking, Scripting
Learn how to look up the geolocation of an IP address in the Linux terminal using a Bash script and a local copy of the GeoLite2 databases.
Resolving the “Clock skew detected” Warning When Using make
Filed under Files
Learn what causes the “Clock skew detected” warning when building an executable with make, and understand how to resolve it.
Checking Which Processes Are Using Semaphores
Filed under Administration, Processes
Learn about semaphores and understand how to find the active ones and the processes currently using them.
Encrypted Remote Backups via rsync
Filed under Administration, Files, Scripting, Security
Learn how to make an encrypted backup of a local unencrypted directory to a remote server via rsync over ssh.
Encrypting and Decrypting Directories on Linux With gocryptfs
Filed under Administration, Security
Explore gocryptfs, a little-known but actively developed project to perform file-based encryption on Linux.
What Does mdev Mean in ping Statistics?
Filed under Administration, Networking
Learn about mdev in the ping statistics and understand the effects of a high standard deviation of round-trip times.
Extracting the Contents of an RPM Package Without Installation
Filed under Administration, Installation
Learn how to extract the contents of an RPM package without installing it.
Clear the Cache of Nginx
Filed under Administration, Networking
Explore different ways to clear the cache on Nginx.
Augmenting the Default Search Path for Python
Filed under Scripting
Learn how to augment the default module search path for finding Python modules.
How to Check PDF Metadata in the Linux Terminal
Filed under File Viewing
Learn how to check the metadata of a PDF document from the command line.
Difference Between apt and apt-get
Filed under Administration, Installation
Learn the difference between the apt and apt-get utilities in Linux.
In What Order Do Piped Commands Run?
Learn about pipes and understand in which order piped processes run.
Linux whois Command With Examples
Filed under Networking
Learn how to use whois, a Linux command-line client to make WHOIS protocol queries.
Convert INI File Into a Bash Array
Learn how to convert an INI file to a Bash array in memory using basic primitives in scripting.
How to Create a Linux Live USB With Persistence Using Easy2boot
Filed under Administration, Installation
Learn how to use Easy2Boot to make live Linux distributions persistent.
How to Automatically Suspend and Wake a Linux Machine
Filed under Administration
Learn two different methods to automatically suspend, sleep, or shut down a Linux machine.
Fixing File Permissions in a Directory Recursively
Filed under File Permissions
Learn how to fix the file permissions in a directory recursively.
Listing Symbolic Link Chains
Filed under Files
Learn how to list a chain of symbolic links in Linux.
Automating ssh-copy-id
Filed under Security
Learn how to automate the usage of ssh-copy-id using the sshpass command.
How to Setup a Base Package Repository in RHEL
Filed under Administration, Installation
Learn how to setup a base package repository in Red Hat Enterprise Linux.
How to Retry a Failed Command in Shell
Filed under Scripting
Learn several methods for retrying an unsuccessful command in the shell.
Send a Message to the Systemd Journal From the Command Line
Filed under Administration
Learn two different methods for sending messages to the systemd journal from the command line.
Disable Hyperthreading From a Running Linux System
Filed under Administration
Learn about hyper-threading and understand how to find out if it’s enabled and how to disable it.
Running a Docker Image as a Container
Filed under Docker
Explore several methods for running a Docker image as a container.
Check Whether a MySQL Database Exists Using Shell
Filed under Administration, Scripting
Learn different methods for checking the existence of a MySQL database from the command line.
Passing Multiple Parameters to a systemd Service
Filed under Administration
Learn four different methods for passing multiple parameters to a service managed by systemd.
How to View .HEIC Photos on Linux
Filed under File Viewing, Files
Learn how to view HEIC images using multiple approaches in Linux.
Script to Automatically Test if a Website Is Available
Filed under Administration, Scripting, Web
Explore a Bash script for checking if a website is working.
Create a Virtual Machine in VirtualBox From a Physical Installation of Linux
Filed under Administration, Installation
Learn various ways to migrate a physical Linux installation to VirtualBox.
How to Create a Random Human-Readable Text File in Linux
Filed under File Editing, Files, Scripting
Learn four methods for generating a human-readable text file with random content in Linux.
iptables – Multiple Source IPs in a Single Rule
Filed under Networking
Learn how to specify multiple source IP addresses in a single rule in iptables.
Explanation of the Archive Mode in rsync
Filed under Files
Learn about the archive mode of the rsync command and its -a option.
Execute a Linux Command Without Keeping It in History
Filed under Scripting
Learn how to execute Linux commands without keeping them in history, either by deleting them after execution or by instructing the shell to not store them in the history file itself.
Run Multiple Commands in Docker CMD Directive
Explore multiple ways to define more than a single command in the Docker CMD directive.
Creating UUIDs in Bash
Filed under Scripting
Learn multiple techniques for generating random-based, time-based and hash-based UUIDs in Bash.
REJECT vs. DROP When Using iptables
Filed under Networking, Security
Understand the the differences between the DROP and REJECT rules when using iptables in Linux.
Make Apache Web Server Listen on Two Different Ports
Filed under Administration, Networking
Learn how to configure the Apache web server to listen on two different ports.
How to Use UFW (Uncomplicated Firewall)
Filed under Administration, Security
Learn how to use the Uncomplicated Firewall (UFW) program in Linux to manage the back-end firewall with some real-world examples.
How to Change the Timezone on Linux
Filed under Administration
Explore the different methods available for changing the timezone on Linux.
How to Ping a Specific Port in Linux
Filed under Networking
Find out the difference between open, closed, and stealth ports in Linux and learn various ways to ping them.
Decompressing a BZ2 Compressed Archive on Linux
Filed under File Compression, Files
Learn different methods for decompressing .bz2 archive files in Linux.
Expand the LVM Space on a Server Accessible Only via SSH
Filed under Administration
Learn two ways to enlarge the space available in LVM in a server accessible only via SSH.
Differences Between Single and Double Brackets in Bash
Filed under Scripting
Learn the differences between single and double brackets in Bash and understand when and how to use them.
How to Resize and Move Partitions in Linux
Filed under Administration, Filesystems
Learn how to resize disk partitions in Linux using some of the actively maintained open-source partitioning tools currently available.
Wipe Free Space in Linux
Filed under Administration, Files
Explore various solutions to wipe free space and remove confidential data from a disk in Linux.
Setting the Processor Affinity of a Process
Filed under Processes
Learn two different methods to bind a process to a specific set of processors in Linux.
Create a Tunnel From One Local Port to Another
Filed under Networking
Learn three tools for creating a tunnel from one local port to another in Linux.
Bash Bitwise Operators
Filed under Scripting
Learn how Bash represents numbers by bits and how we can use bitwise operators to do basic operations on them.
Understanding and Configuring Linux Network Interfaces
Filed under Networking
Understand the /etc/network/interfaces configuration file and learn how to configure the network in Linux.
Waiting for a File in a Shell Script
Learn two different methods to detect the creation of a file in a shell script.
Execute a Command Whenever File or Directory Changes
Learn how to monitor a directory recursively and execute a command whenever the files and directories within it change.
Checking the Health of a Storage Device in Linux
Filed under Administration
Learn multiple methods and tools to check the health of storage devices in Linux.
The arping Command
Filed under Networking
Learn about the arping command in Linux, understand its various options and how to use them with several examples.
Copying Symbolic Links With rsync
Filed under Files
Learn multiple ways for copying symlinks using the rsync command in Linux.
Search and Replace in Vim
Filed under File Editing, Files
Explore the different methods available for performing a search and replace with the Vim editor.
Rotating Videos Using FFmpeg
Filed under Files
Learn multiple methods for rotating videos to different degrees using FFmpeg.
Running a Script That’s Not Executable
Filed under File Permissions, Scripting
Learn two different ways to execute a shell script that isn’t executable in Linux.
Running the NGINX Server in a Docker Container
Filed under Docker, Networking
Learn how to run an Nginx container both by creating one from scratch using a Dockerfile and by using the official Nginx Docker image.
Running a Command That Is Shadowed by an Alias
Filed under Scripting
Learn a few different methods to run commands that have been shadowed by an alias in Linux.
Where Do Files Go When the rm Command Is Issued?
Filed under Files, Filesystems
This short article explains what happens to files and directories when we issue the rm command to delete them.
Differences Between the return and exit Commands
Filed under Scripting
Learn the differences between the return and the exit commands in Linux using several examples.
The set Command in Linux
Filed under Scripting
Learn about the set command in Linux, its various options and their use cases.
Retrieve Video Information on the Command Line in Linux
Filed under Scripting
Learn various command-line tools to retrieve information from video files in Linux.
How to Extract IPv4 Addresses from Files in Linux
Filed under Administration, Files
Explore different methods to extract IPv4 addresses from a file in Linux.
List All Available Commands and Aliases in Linux
Filed under Administration, Scripting
Learn three approaches for listing all the available commands and aliases in Linux.
How to grep Hidden Files and Directories
Filed under File Searching, Files
Learn how to use the grep command to search for a specific text pattern in a directory tree containing hidden files and directories.
Getting the PID of a nohup Process
Filed under Processes
Learn how to get the PID of a background process started with nohup.
Difference Between awk, nawk, gawk and mawk
Filed under File Editing, File Searching
Learn about the awk, nawk, gawk, and mawk interpreters and understand the differences between them.
Get the Path of a Process in Linux
Filed under Processes
Learn how to find the path of a process in Linux.
The Difference Between fork(), vfork(), exec() and clone()
Filed under Processes
Learn the similarities and differences between the fork(), vfork(), exec(), and clone() system calls with examples.
SIGINT Propagation Between Parent and Child Processes
Filed under Processes
Learn about signals in Linux processes and understand why SIGINT is not propagated to child processes.
How to Exclude Files and Directories When Creating a tar.gz File
Filed under File Compression, Files
Learn multiple methods to exclude specific files or directories when creating a .tar.gz archive.
The Difference Between #!/usr/bin/bash and #!/usr/bin/env bash
Filed under Scripting
Explore the differences between #!/usr/bin/bash and #!/usr/bin/env bash shebang lines and understand their advantages and disadvantages.
Buffer and Cache Memory in Linux
Filed under Administration
Learn about buffer memory and cache memory in Linux and the differences between them.
Suppress Echo of Command Invocation in a Makefile
Learn about the echo of command invocation in a Makefile and how to suppress it to reduce unnecessary output.
Removing a Trailing Newline From a File
Filed under File Editing, Files
Learn various Linux commands for removing single as well as multiple trailing newlines from the end of a file.
Print Statistics of Numbers on the Linux Terminal
Filed under Scripting
Learn various Linux tools for calculating statistics like max, min, median, mode, standard deviation, and more.
View the List of Functions Exported by a Linux Shared Library
Filed under Administration
Learn about exported functions in Linux shared libraries and how to view them.
Automating Telnet Sessions Using expect
Filed under Networking, Scripting
Learn different ways to automate telnet sessions using the expect command.
An Overview of ARM64, ARMel and ARMhf Processor Architectures
Filed under Administration
Learn what ARM processors are, and the Debian GNU/Linux ports that are available to support some of its architectures.
How to Get the MAC Address of a Network Interface
Filed under Networking
Learn how to find the MAC address of a network interface in Linux.
Difference Between the Result of free and top Commands
Filed under Processes
Learn the similarities and differences between the free and top commands in Linux.
Fixing the “/bin/sh: pushd: Not Found” Error in Linux
Filed under Scripting
Learn the uses of the pushd command and how to mimic its behavior on systems where it’s not available.
Division with Variables in a Linux Shell
Filed under Scripting
Learn multiple ways of performing division on integers and floating-point numbers in Bash
Get the Most Recent File in a Directory
Filed under Files
Learn various methods to get information about the most recently modified file in a directory in Linux.
Downloading Content Using wget Without Following Redirects
Learn how to prevent wget from following redirects when downloading content in Linux.
Using the passwd Command from Within a Shell Script
Filed under Administration, Scripting
Learn multiple methods to set a user’s password non-interactively inside a shell script in Linux.
How to Encrypt a Large File with OpenSSL
Learn how to encrypt and decrypt a large file in Linux using OpenSSL.
Kill a Child Process After a Given Timeout in Bash
Learn various methods for killing child processes after a given timeout in Bash.
Setup Public Key Authentication for SSH
Filed under Security
Learn how to set up public-key authentication between a local computer and a remote server. Also, find out how to disable traditional password-based authentication to protect the remote server from brute-force attacks.
How to Write Stdout to a File with Colors
Learn various methods for saving standard output to a file while preserving the colors.
How to Find Non-ASCII Characters in Text Files in Linux
Learn multiple methods for finding and highlighting non-ASCII characters within text files.
Convert Symlink to Regular File on Linux
Filed under Files
Learn various methods for converting symlinks into regular files in Linux.
Configure a Systemd Service to Restart Periodically
Filed under Administration, Scripting
Learn multiple ways to periodically restart a systemd service in Linux.
Creating a Hex Dump of a File
Filed under File Viewing, Files
Learn how to create the hex dump of a file in Linux using different tools.
How to Disable User Logins on Linux
Filed under Administration, Security
Learn multiple methods to block user logins on Linux and also understand the differences between the methods.
How to Write Bash Variable Contents to a File
Filed under File Editing, Scripting
Learn multiple ways to write the contents of a Bash variable to a file in Linux.
Maximum Number of Threads per Process in Linux
Filed under Processes
Learn why there’s a limit on the number of threads per process in Linux, and how to find out what that limit is.
Differences Between PID, TID and PPID in Linux
Filed under Processes
Learn the differences between Process Identifier, Thread Identifier, and Parent Process Identifier in Linux, and also how to retrieve this information using various approaches.
Linux Command-Line Tools to Take Website Screenshots
Filed under Scripting
Learn how to use Firefox and Chrome to take screenshots of a website from the command-line.
Get File Creation Date/Time in Bash
Filed under File Viewing, Files
Learn various methods to get the file creation date on Linux systems.
Configuration Files in Linux
Filed under Administration, Files
Learn how to configure Linux without using any UIs.
How to Redirect Command Output in Docker
Filed under Docker
Learn various ways to redirect command output in Docker.
Solving The “Cannot Open Shared Object File: No Such File Or Directory” Error In Linux
Learn what causes the “cannot open shared object file: No such file or directory” error in Linux, and how to fix it.
How to Edit Binary Files on Linux
Filed under File Editing, Files
Learn what binary files are, and how to edit them using various tools.
Start Script After Another Finishes in Linux
Filed under Scripting
Learn how to run scripts one after the other in Linux using bash commands under various conditions.
Run Bash Script as a Daemon
Filed under Scripting
Learn how to run a bash script as a daemon in the background.
Fixing the “Command Not Found” Error When Using Sudo
Filed under Administration
Learn what causes the “command not found” error when using sudo in Linux and explore possible fixes.
How to Add a String After Each Line in a File in Linux
Filed under File Editing, Files
Learn how to add a string to the end of each line of a file in Linux using sed, awk, echo, perl, and other commands.
POSIX Shell Array/List Data Structure
Filed under Scripting
Learn about the differences between bash and POSIX arrays and how to use them in your scripts.
Get the Full Path of a File in Linux
Filed under Files
Learn multiple ways to find the absolute path of a file in Linux.
Limit on File Name Length in Bash
Filed under Files
Learn how to find the limit on the length of filenames in Linux.
How Are Linux PIDs Generated?
Filed under Processes
Learned about process IDs in Linux – how they are generated, how high they can go, and what happens when the limit is hit.
Segmentation Fault in Linux
Filed under Scripting
Learn all about the segmentation fault – what it is, what causes it and how you can prevent it.
Comparing Two Files in Linux
Filed under File Viewing, Files
Learn how to compare two text files in Linux, and also find out how you can narrow down the comparison to find only addition/removal differences between them.
Removing the Last Character of a File
Filed under File Editing, Files, Scripting
Learn multiple command-line techniques for removing the last character in a file.
Extracting Certificate Information with OpenSSL
Filed under Networking, Security
Learn how to extract information from an X.509 certificate using the OpenSSL tool.
Determine the Current Shell in Linux
Filed under Administration
Learn multiple ways to find out the current, running shell in Linux.
Baeldung on Scala
- All
- Scala Collections (4)
- Libraries (2)
- Scala Web (1)
- Scala Strings (1)
- Scala Numbers (1)
- Scala Basics (1)
- Play Framework (1)
- Persistence (1)
- Akka (1)
Sorted Sets in Scala
Filed under Scala Collections
Explore SortedSet and learn how to keep elements in a specific order through natural ordering or a provided comparator.
Serving Static Assets in Play
Filed under Play Framework, Scala Web
Learn how to serve static assets like images, CSS, and JavaScript in a Play application.
Introduction to Kafka With Scala
Filed under Libraries
Explore Kafka using Scala and learn how to produce and consume messages on a topic.
Introduction to Spire
Filed under Libraries, Scala Numbers
Learn about Scala Spire, a library that provides performant and generic numeric types.
Difference Between tell and forward in Akka Actor
Filed under Akka
Learn the difference between the tell() and forward() methods of Akka Actors.
Introduction to Skunk – Scala Driver for PostgreSQL
Filed under Persistence
Learn the basics of Skunk, a purely functional Scala driver for PostgreSQL.
Scala Interview Questions
Filed under Scala Basics
Explore some of the basic Scala questions that could come up in a technical interview for Scala developers.
Initializing an Array in Scala
Filed under Scala Collections
Learn multiple approaches for initializing an array in Scala.
Copy an Array to Another in Scala
Filed under Scala Collections
Learn various approaches for copying the elements of an array into another in Scala.
Get a List Item by Index in Scala
Filed under Scala Collections
Learn various ways of accessing the items of a List in Scala.
String Comparison in Scala
Filed under Scala Strings
Learn various approaches for comparing Strings in Scala.
Baeldung on Computer Science
- All
- Programming (1)
- Networking (1)
- Artificial Intelligence (1)
Different Types of DNS Records
Filed under Networking
Understand the common DNS record types that can be encountered in domain management.
Neurons in Neural Networks
Filed under Artificial Intelligence
Explore the structure and functioning of artificial neurons in neural networks and understand deeply the architecture of a neural network, its layers, and their several important benefits.
What Is the Difference Between Signed and Unsigned Variables?
Filed under Programming
Understand how numbers are represented in binary and learn the differences between signed and unsigned variables.
Baeldung on Kotlin
- All
- Kotlin Strings (3)
- Spring (2)
- Libraries (2)
- Kotlin Server-Side (2)
- Kotlin Collections (2)
- Kotlin Classes and Objects (2)
- Testing (1)
- Patterns (1)
- Kotlin Numbers (1)
- Kotlin Dates (1)
- Kotlin Basics (1)
- Kotlin (1)
- HTTP Client-Side (1)
- Functional Programming (1)
Convert Any to Int in Kotlin
Filed under Kotlin Classes and Objects
Learn various ways to convert a variable of type Any to an Int and understand why this requires careful consideration of the data at hand.
Strategy Design Pattern in Kotlin
Filed under Patterns
Explore the Strategy design pattern in Kotlin and understand the problem that the pattern solves.
Functional Error Handling in Kotlin
Filed under Functional Programming
Learn how to develop recovery logic in a structured way using functional error handling.
Working With Pair in Kotlin
Filed under Kotlin Collections
Learn how the Pair class works in Kotlin.
Check if a Character Is Alphabetic or Not in Kotlin
Filed under Kotlin Strings
Explore various techniques to determine if a character is alphabetic in Kotlin.
Testing a Lambda Function With Mockito Kotlin
Filed under Testing
Learn how to test a lambda expression by capturing it using the mockito-kotlin library.
Code Formatting in Kotlin Using Ktlint
Filed under Libraries
Learn how to format code in Kotlin projects using the Ktlint linting tool.
Introduction to Http4k
Filed under Kotlin Server-Side
Learn about Http4k and its elegant, functional approach to Kotlin backend development.
Creating a List of Objects in Kotlin
Filed under Kotlin Collections
Explore three common methods for creating lists of objects in Kotlin.
RestTemplate Examples in Kotlin
Filed under HTTP Client-Side, Spring
Learn various methods provided by the RestTemplate class to make HTTP requests in Kotlin.
Spring Integration With Kotlin
Filed under Kotlin Server-Side, Spring
Learn about the Spring Integration Kotlin DSL and explore its basic features.
Mapstruct With Kotlin’s Data Classes
Filed under Libraries
Learn how to use Mapstruct to create mappings between data classes in Kotlin.
How to Convert a Date Time String to Instant in Kotlin
Filed under Kotlin Dates, Kotlin Strings
Learn how to convert a date time string to Instant in Kotlin.
Difference Between “open” and “public” Keywords in Kotlin
Filed under Kotlin Basics, Kotlin Classes and Objects
Understand the differences between using the “open” and “public” keywords in Kotlin.
Explicit API Mode in Kotlin
Filed under Kotlin
Learn about the explicit API mode in Kotlin and how it can help us keep our public APIs less error-prone.
Guide to Base64 Encoding and Decoding Strings in Kotlin
Filed under Kotlin Strings
Learn the basics of Base64 encoding and explore a few popular ways to encode and decode strings to Base64 in Kotlin.
Rounding Numbers in Kotlin
Filed under Kotlin Numbers
Learn multiple ways to perform rounding of numbers in Kotlin.
Baeldung on Ops
- All
- Docker (6)
- Kubernetes (2)
- Virtual Machine (1)
- Jenkins (1)
- DevOps (1)
Edit a Kubernetes Deployment Without Modifying the File Manually
Filed under Kubernetes
Learn how to edit a Kubernetes Deployment object on the fly without using the original declarative configuration file.
Introduction to the Pants Build Tool
Filed under DevOps
Learn the basic functionality of the Pants build tool and understand its usage.
How to Get the List of Dependent Child Images in Docker
Filed under Docker
Learn how to get the list of dependent child images of a Docker image.
Difference Between targetPort and port in Kubernetes Service Definition
Filed under Kubernetes
Understand the differences between port and targetPort in Kubernetes and learn how to configure them correctly to ensure effective communication between Services and pods.
Run Multiple Commands in Docker Run
Filed under Docker
Learn how to run multiple commands on the startup of a Docker container.
A Guide to Vagrant
Filed under Virtual Machine
Learn how to manage development environments with Vagrant and understand the use cases and the different configuration options.
How to Run TestNG Tests on Jenkins
Filed under Jenkins
Learn the steps needed to run TestNG tests on Jenkins.
Mounting a Single File in a Volume Using Docker
Filed under Docker
Learn multiple ways for mounting a single file in a volume using Docker.
Difference Between Expose and Ports in Docker Compose
Filed under Docker
Explore the differences between expose and ports when using Docker Compose.
Docker Registry API – Listing Images and Tags
Filed under Docker
Learn how to use the Docker Registry API to list images and tags in a remote registry.
Restart a Single Container With Docker Compose
Filed under Docker
Learn how to restart a single Docker container using Docker Compose.