Browsing Category

BASH Programming

How Does PATH Work in Bash

When you’re typing a command in the Linux terminal, you’re generally calling a program to do a certain job, for example, ls, cd, rm, mkdir, etc. All these programs are located somewhere in the file system, right? How does bash know…

74 Bash Operators Examples

Different types of operators exist in Bash to perform various operations using bash script. Some common groups of bash operators are arithmetic operators, comparison operators, bit-wise operators, logical operators, string operators,…

Bash Tac Command

Tac is one of those commands that you don’t realize until you have already gone and done it, reinvented the wheel, which is not uncommon in the practice of programming whether you are just learning the ropes or are a professional with…

30 Bash loop examples

Three types of loops are used in bash for various purposes. These are for, while and until loops. The different uses of these loops are explained by using 30 different examples in this article. Uses of Bash loops: Using for loop to…

Bash string manipulation

In bash, not unlike any other programing language, a program lives to put things into buckets and name them for later use. These buckets are available to manipulate throughout the lifetime of the program or until discorded manually or…

How to make BASH suit you better

BASH has a simple standard setup which is great but you may want more! Many computer users avoid the command line, because it is hard to use. This is a misconception. The command line has a learning curve, it requires some knowledge to…

Bash shuf command

Shuf is one of those commands that most bash programmers have not heard. For those who have, the experience itself is often eerie, like a whisper coming from a dark distant terminal where long-forgotten commands end up.  Those that…

Bash builtin examples

builtin candidate_builtin arg … in bash allows you to only call bash builtins. That is, even if an external command or function exists also named candidate_builtin (or something more creative), bash will ignore it and only try to run…

Bash cut command

The beauty of programming in bash is that if a command is available in the environment that you are working in or your script will run in, you can make use of it just by knowing its name. Commands such as those included in the…

Bash Export Command

If you’ve ever stood in front of a terminal, typed `declare -p` to see what is going on with your variables in bash, and hit enter, cool! You are going to be killing it with export in bash in no time. Here you will learn how to use…

Bash exit on error

An exit status code is returned when any Linux command is executed from the terminal, either the command is successful or unsuccessful. This status code can be used to show the error message for unsuccessful execution or perform any…

Bash `pushd` command

The Linux users may need to switch between many directories for doing a particular task and it is a time consuming task for the user to change the directory location frequently from the terminal. If the previously visited file or…

Bash brace expansion

Bash uses brace expansion to generate a sequence of strings from the terminal or by using any bash script. A sequence of expressions or comma-separated list of data with curly brackets is used to define brace expansion. Two optional…

Bash trap command

A built-in bash command that is used to execute a command when the shell receives any signal is called `trap`. When any event occurs then bash sends the notification by any signal. Many signals are available in bash. The most common…