When writing a Bash script, it is common that you’ll run into the need to check for the existence of a directory. Based on the result, your Bash script can proceed with the appropriate action.
bash
Bash all arguments print
The purpose of this tutorial is to show how to print all of the arguments submitted from the command line in a Bash script on Linux. There are several different methods for doing this, as you will see in the examples below.
Calculate column average using bash shell
The purpose of this tutorial is to show how the Bash shell can calcuate the average value of a single column of a text file on a Linux system.
Random Word Generator
Sometimes a Linux user can be in need of a random word generator. Random words can be used to set a new password or simply to create a bunch of randomly named directories. If you need a single word, the easiest way is to visit an online Random Word Generator website. However, if you need to generate more words or automate your task, the Linux Bash shell can be a handy friend.
unrar – rar extract on Fedora Linux
Files with a .rar extension are compressed archives, much like a .tar.gz or .zip file. It is one of many file compression formats that rose to popularity over the years, but requires its own utility to use.
How to manage Bash history
BASH (Bourne Again SHell) is the default shell in practically all Linux-based operating systems. All the commands we write in the terminal are interpreted by the shell, and become part of its history. In this tutorial we see where the shell history is saved, and how to manage it using the “history” built-in command and some environment variables.
SSH remote login syntax and examples
The SSH protocol in Linux is used to manage remote systems. Ordinarily, this would be another Linux system, but it could also be a firewall, router, or even a different operating system entirely. Using the SSH protocol to remotely log into another system will give you a command line terminal that you can fully access as if you were physically in front of the machine.
How to create temporary files using mktemp on Linux
Temporary files and directories are very important: they can be used from shell scripts for example, to store information which are necessary to complete some tasks and can be safely removed once the work is done. In this tutorial we will see how to safely create temporary files and directories using the mktemp
utility on Linux.
adduser vs useradd in Linux
All Linux systems have access to hundreds or thousands of different commands. Some of these commands serve similar purposes, though there is usually a particular tool that is more suited for certain jobs. Such is the case with the adduser and useradd commands on Linux.
US postal 5 digit zip code regex validation
The purpose of this tutorial is to show how to use a Bash shell script or Python programming code to validate a United States zip code number on a Linux system.
Regex to validate credit card number
The purpose of this tutorial is to show how to use a Bash shell script or Python programming code to validate a credit card number on a Linux system.
Nohup command in Linux with Examples
The nohup command in Linux is used to tell a process to ignore any SIGHUP
(hangup) signals that it receives. The SIGHUP signal is sent to a background job whenever the current terminal is closed. Thus, we can have a job in the background, close the terminal, and still see it running in the background.