If you are new to xargs, or do not know what xargs is yet, please read our xargs for beginners with examples first. If you are already somewhat used to xargs, and can write basic xargs command line statements without looking at the manual, then this article will help you to become more advanced with xargs on the command line, especially by making it multi-threaded.

In this tutorial you will learn:

  • How to use xargs -P (multi-threaded mode) from the command line in Bash
  • Advanced usage examples using multi-threaded xargs from the command line in Bash
  • A deeper understanding of how to apply xargs multi-threaded to your existing Bash code

The need to compare strings in a Bash script is relatively common and can be used to check for certain conditions before proceeding on to the next part of a script. A string can be any sequence of characters. To test if two strings are the same, both strings must contain the exact same characters and in the same order. It could be a word or a whole sentence. For example, string one is equal to string one but is not equal to string two. Get the idea?

In this guide, we'll show you how to compare strings in the Bash shell on a Linux system. We'll show this in the context of a simple if/else Bash script so you can see how testing for this condition would work when developing scripts, but we'll also show how this same comparison can be done in the command line terminal.

In this tutorial you will learn:
  • How to compare strings in Bash
  • Example if/else Bash scripts that compare strings

The date command on a Linux system is a very versatile command that can be used for many functions. Among them is the ability to calculate a file's creation date, last modified time, etc. This can be built into a script, used for scheduling, or just used to obtain basic information about a file or directory on the system.

The date command can also handle addition and subtraction arithmetic to help calculate dates and times. It uses Unix's epoch time as a base of reference, which is 00:00:00 UTC on January 1, 1970. From this date, it can assign a timestamp based on the number of seconds something occurred before or after it.

These timestamps are great for calculation, but hardly usable for people. It'd take a machine to know that Thu 02 Jun 2016 12:59:59 PM UTC translates to 1464872399. In this guide, we'll explain how to convert a timestamp to a human readable date and vice versa.

In this tutorial you will learn:
  • How to convert a timestamp to date

Suppose we write a script which spawns one or more long running processes; if said script receives a signal such as SIGINT or SIGTERM, we probably want its children to be terminated too (normally when the parent dies, the children survives). We may also want to perform some cleanup tasks before the script itself exits. To be able to reach our goal, we must first learn about process groups and how to execute a process in background.

In this tutorial you will learn:

  • What is a process group
  • The difference between foreground and background processes
  • How to execute a program in background
  • How to use the shell wait built in to wait for a process executed in background
  • How to terminate child processes when the parent receives a signal

Have you or one of your MySQL users forgotten the password to a MySQL account? It's very easy to reset a MySQL user password on Linux, and we'll show you the commands and step by step instructions below.

Changing the MySQL root password is a bit more involved, so we've written a separate guide on how to change MySQL root password.

In this tutorial you will learn:
  • How to change MySQL user password

When coding Bash scripts - especially when developing scripts for functionality testing - we sometimes need to generate a random number or random input. These numbers may also need to be within a specific range. This article will teach you how to perform random number generation in Bash.

In this tutorial you will learn:

  • How to generate random numbers in Bash
  • How to generate random numbers is a specific range
  • Examples demonstrating random number generation in Bash

When using random numbers in Bash, the question of random entropy will sooner or later come up. This article will help you understand what entropy is, how it can be modified and optimized in Bash, and how it will affect random number generation.

In this tutorial you will learn:

  • How to generate random entropy in Bash
  • How to pre-seed the random number generator in Bash
  • Examples demonstrating random entropy generation in Bash

Using xargs, described in the Linux xargs manual as a tool which builds and execute command lines from standard input, once can exert a significant amount of additional power over any other command executed on the Bash command line. Basically, xargs will take the output from any other tool, and use that as it’s own input for further processing and action (hence the reference to executing command lines in the manual). If this is your first few weeks or months with xargs, or you are only just starting, this is the best place for you to get into xargs.

In this tutorial you will learn:

  • How to use xargs from the command line in Bash
  • How xargs works, what it does, and how to use it well
  • Basic usage examples using xargs from the command line in Bash

The Bash command line provides nearly limitless power when it comes to executing nearly anything you want to do. Whether it is processing a set of files, editing a set of documents, handling big data, managing a system or automating a routine, Bash can do it all. This series, of which today we present the first part, is sure to arm you with the tools and methods you need to become a much more proficient Bash user. Even already advanced users will likely pickup something new and exciting. Enjoy!

In this tutorial you will learn:

  • Useful Bash command line tips, tricks and methods
  • How to interact with the Bash command line in an advanced manner
  • How to sharpen your Bash skills overall and become a more proficient Bash user

Using the power of regular expressions, one can parse and transform textual based documents and strings. This article is for advanced users, who are already familiar with basic regular expressions in Bash. For an introduction to Bash regular expressions, see our Bash regular expressions for beginners with examples article instead. Another article which you may find interesting is Regular Expressions in Python.

Ready to get started? Dive in and learn to use regexps like a pro!

In this tutorial you will learn:

  • How to avoid small operating system differences from affecting your regular expressions
  • How to avoid using too-generic regular expression search patters like .*
  • How to employ, or not employ, extended regular expression syntax
  • Advanced usage examples of complex regular expressions in Bash

Using regular expressions in Bash provides you with plenty of power to parse nearly every conceivable text string (or even full documents), and transform them into nearly any output desirable. If you regularly use Bash, or if you regularly work with lists, textual strings, or documents in Linux, you will find that many jobs can be simplified by learning how to use regular expressions in Bash. Continue reading to learn basic Bash regular expression skills! If you are already familiar with basic regular expressions in Bash or another coding language, see our more advanced bash regular expressions. If not, continue reading to learn basic Bash regular expression skills!

In this tutorial you will learn:

  • How to use regular expressions on the command line in Bash
  • How regular expressions can parse and transform any text string and/or document
  • Basic usage examples of regular expressions in Bash

The things you can do using Bash script are limitless. Once you begin to developed advanced scripts, you’ll soon find you will start to run into operating system limits. For example, does your computer have 2 CPU threads or more (many modern machines have 8-32 threads)? If so, then you will likely benefit from multi-threaded Bash scripting and coding. Continue reading and find out why!

In this tutorial you will learn:

  • How to implement multi-threaded Bash one-liners directly from the command line
  • Why multi-threaded coding almost always can and will increase the performance of your scripts
  • How background and foreground processes work and how to manipulate job queues

Nowadays Javascript can be easily defined as the world most used programming language: it is used on a variety of platforms, it is integrated in web browsers and thanks to the Node.js runtime it can also be used server-side. In this tutorial we will see the loops we can be used in modern Javascript.

In this tutorial you will learn:

  • What is the syntax and how the while loop works in Javascript
  • The syntax of the do/while loop and how it works in Javascript
  • The syntax of the for loop and how it works in Javascript
  • The syntax of the for/of loop and how it works in Javascript
  • The syntax of the for/in loop and how it works in Javascript

Ready to dive into Bash looping? With the popularity of Linux as a free operating system, and armed with the power of the Bash command line interface, one can go further still, coding advanced loops right from the command line, or within Bash scripts.

Harnessing this power, one can manipulate any document, any set of files, or implement advanced algorithms of almost any type and flavor. You are unlikely to run into any limitations if you use Bash as the basis for your scripting, and Bash loops form a powerful part of this.

That said, Bash loops sometimes can be tricky in terms of syntax and surrounding knowledge is paramount. Today we present with you a set of bash loop examples to help you upskill quickly and become Bash loop proficient! Let's get started!

In this tutorial you will learn:
  • How Bash for, while and until based loops work, with examples
  • How Bash requires terminating of loop-starting statements before the do...done section of the loop can follow, and how this relates to if and other statements
  • How to implement basic and medium advanced bash loops
  • How subshells work and how they can be used inside bash loop scope declarations
  • How to start coding loops defensively, avoiding errors in the output
  • How to code one-liners (a common term used amongst Bash developers) on the command line versus implement the same code in a Bash script
  • How the ; syntax idiom is an important matter when it comes to coding Bash loops, both on the command line and in scripts

Java is perhaps the most widely used programming language nowadays. It's robustness and platform-independent nature enables Java based applications to run on mostly anything. As is the case with any application, we need to store our data in some sort of reliable way - this need called databases to life.

In Java database connections are implemented by JDBC (Java Database Connectivity API), that let's the programmer handle different kind of databases in almost the same way, which makes our lives much easier when we need to save or read data from a database.

In this tutorial we will create an example Java application that will be able to connect to a PostgreSQL database instance, and write data into it. To check that our data insertion is successful, we'll also implement reading back and print the table we inserted data into.

In this tutorial you will learn:
  • How to setup the database for the application
  • How to import PostgreSQL JDBC Driver into your project
  • How to insert data into the database
  • How to run a simple query to read a database table's content
  • How to print fetched data

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in: