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 nowdays. 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

Example 1 A regular expression (often abbreviated to “regex”) is a technique, and a textual pattern, which defines how one wants to search or modify a given string. Regular expressions are commonly used in Bash shell scripts and in Python code, as well as in various other programming languages.

In this tutorial you will learn:
  • How to start with Regular Expressions on Python
  • How to import regex Python module
  • How to match strings and characters using Regex notation
  • How to use the most common Python Regex notations

On Linux and other Unix-like operating systems, tar is undoubtedly one of the most used archiving utilities; it let us create archives, often called “tarballs”, we can use for source code distribution or backup purposes. In this tutorial we will see how to read, create and modify tar archives with python, using the tarfile module.

In this tutorial you will learn:
  • The modes in which a tar archive can be opened using the tarfile module
  • What are the TarInfo and TarFile classes and what they represent
  • How to list the content of a tar archive
  • How to extract the content of a tar archive
  • How to add files to a tar archive

Cookies are all around in our everyday life while we browse the Internet. Most people wouldn't know much about them, if not for those "our website uses cookies to be operational" signs that are on mostly any page now since GDPR. Cookies have a long history if sometimes being good, sometimes bad. As it is usual with most aspects of the world, this technology can be used in a good or bad way.

In this tutorial we will explore cookies a bit from the server side programming perspective: we'll create an example cookie in PHP, and store the visitor's chosen username in it. The cookie will reside in the browser of the visitor, so on the next visit we can read it and use it to greet the visitor on the username submitted. Our simple webpage will recognize the visitor as long as the cookie is present in the browser. We do not store any information on the server side: if the visitor first checks in from a PC, and next time from a smartphone, we will not know it is the same individual. This is one of the main point with cookies: we can only identify the given client, and only as long as the data is provided by that particular browser.

In this tutorial you will learn:
  • How to setup the test environment
  • How to write a simple example program that uses cookies
  • How to test the workings of the program
  • How to reset the environment

In this tutorial we will learn the basics of the dialog utility, in order to use ncurses widget in our shell scripts. We will see how to install dialog in the most used Linux distributions, some of the common options we can use to alter the behavior of dialog, how to use some widgets; among the others: inputbox, checklist, radiolist and yesno. Finally, we will see how to use the data obtained by the widget processing.

In this tutorial you will learn:
  • How to install the dialog utility on Linux
  • What are the most relevant dialog options
  • How to use the inputbox, checklist, radiolist, passwordbox, msbox, calendar and yesno widgets
  • How to manage data derived from the widget processing

We all very often use bash scripts to automatize boring and repetitive tasks. Sometimes in our scripts we need to ask the user to perform one or more choices interactively: in this tutorial we will see how to use the Bash shell select statement to perform such operation in very few lines of code.

In this tutorial you will learn:
  • How to use the Bash select statement
  • How to customize the select menu prompt

The JSON (JavaScript Object Notation) format is widely used to represent data structures, and is frequently used to exchange data between different layers of an application, or by the use of API calls. We probably know how to interact with json-formatted data with the most used programming languages such as parsing JSON with python, but what if we need to interact with it from the command line, or in a bash script? In this article we will see how we can accomplish such a task by using the jq utility and we will learn its basic usage.

In this tutorial you will learn:
  • How to install jq in the most used Linux distributions or compile it from source
  • How to use jq to parse json-formatted data
  • How to combine filters using "," and "|"
  • How to use the length, keys, has and map functions

Well you have written an awesome Bash script. It works perfectly and perhaps there is no need to add new functionality. Well, maybe not for now, at least! At this stage you are happy with the script. However, after few months you reopen your bash script again to add new feature and you get a headache to figure out on how the script actually works. Hence, you need to spend additional energy and time before you can actually start editing the script in order to add new feature.

Well, at this point you regret that you did not put some comments ( notes ) into the script to remind you of how the bash script is structured. Not only that Bash comments serve as excellent notes for you or anybody else who might work with your script they may be to some extend also used as a basic bash script debugging tool.

In this tutorial you will learn:
  • How to comment on bash command line
  • How to write comment bash scripts
  • How to create multiple line comments

There are techniques from traditional programming environments that can help. Some basic tools like using an editor with syntax highlighting will help as well. There are builtin options that Bash provides to make debugging and your everyday Linux System Administration job easier.

In this article you will learn some useful methods of debugging Bash scripts:
  • How to use traditonal techniques
  • How to use the xtrace option
  • How to use other Bash options
  • How to use trap

A database view is nothing but a virtual table, which does not contains data itself, but references data contained in other tables. Views are basically the result of stored queries which can vary on complexity and can be used, for example, to hide data from users, allowing access only on selected columns of a table, or simply to provide a different point of view on the existing data. In this tutorial we will see how to create, update, alter and drop a view on a MySQL, MariaDB database.

In this tutorial you will learn:
  • What is a view
  • How to create a view
  • How to update a view
  • How to alter a view
  • How to drop a view

The open source libcurl is client-side URL transfer library which supports a lot of protocols like FTP, HTTP, HTTPS  and works on a multitude of platforms. The PHP cURL module let us access the functionalities provided by the library from the PHP programming language. In this tutorial we will see how to install the module and how to use it to perform simple requests.

In this tutorial you will learn:
  • How to install the cURL module
  • The basic steps to follow to initialiaze a cURL session and perform a request
  • How to perform a GET request with PHP cURL
  • How to perform a POST request with PHP cURL

Default bash command line prompt on many Linux systems is quite minimal. As we will see in this article, it can be easily changed by modifying bash PS{n} variables, so to include information such as display time, load, number of users using the system, uptime and more.

In this tutorial you will learn:
  • What are PS1 and PS2 shell variables
  • How to create custom shell prompts
  • What are the characters we can use to customize a shell prompt

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: