xargs for beginners with examples

xargs for beginners with examples

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

Read more

Random Entropy in Bash

Random Entropy 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

Read more

Advanced Bash regex with examples

Advanced Bash regex with examples

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

Read more

Git tutorial for Beginners

Git tutorial for Beginners

If you have been using GNU/Linux for any amount of time chances are pretty good that you have heard of git. You may be wondering, what exactly is git and how do I use it? Git is the brainchild of Linus Torvalds, who developed it as source code management system during his work on the Linux kernel.

Read more

Python Regular Expressions with Examples

Python Regular Expressions with Examples

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

Read more

Multi-threaded Bash scripting & process management

Multi-threaded Bash scripting & process management at the command line

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

Read more

Bash Scripting - Bash Loops with examples

Bash Loops with examples

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

Read more

Git Branching Tutorial for beginners

Git Branching Tutorial for beginners

Branching allows git to track multiple lines of development. This essentially allows you to have multiple versions of your project in development at the same time. For example, many projects will choose to have a stable master branch while new features or bug fixes are implemented in a development or testing branch. Once the project organizers are satisfied that the changes made in the development branch have reached the required level of maturity, they may choose to merge those changes into the master branch.

Read more

Batch Convert Audio Files With FFMPEG

How to Batch Convert Music Files with FFMpeg

FFMpeg is at the core of tons of multimedia utilities, but the utility itself doesn’t have the ability to convert multiple files at once. Thankfully, FFMpeg is scriptable, and you can easily set something up quickly with Bash.

In this tutorial you will learn:

  • How to Set Up Your Variables
  • How to Construct the Loop
  • How to Strip Out the File Names
  • How to Put it All Together, and Run

Read more

How to check Bash version

Objective

This article will provide you with the information on how to check bash version on your operating system.

Operating System and Software Versions

  • Operating System: – Distribution Agnostic

Requirements

No special prerequisites are required is required.

Read more

linux-bash-prompt

How to Change Bash Prompt

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

Read more