How to use BASH here documents

Use BASH here documents whenever you need a multi-line text inside redirection.

February 8, 2023 · milosz · Bash

How to use templates inside shell scripts

Use templates inside shell scripts by substituting environment variables.

February 15, 2021 · milosz · Bash · Debian

How to create custom bash prompt

Today, I will show you my personal shell prompt, so you could define your own custom bash prompt.

How disable network redirections

Create custom Bourne Again SHell package to disable network redirections and enhance system security.

How to find out whether remote port is open using network redirections

Find out whether remote port is open using Bourne Again SHell network redirections.

How to manage remotely forwarded SSH authentication agent

Keeping SSH authentication agent in sync across multiple servers and terminal multiplexers is not an easy task, but can be solved by using consistent socket names used to connect to the SSH authentication agent.

How to parse INI configuration file using Bash

Parse INI configuration file using Bash shell-script.

How to store configuration within shell script

Store runtime configuration within shell script using simple but an effective method.

How to solve pipeline mysteries

I have already described how to inspect a pipeline, but today I will show you how to write a shell script that will help you reconstruct a whole pipeline when all you got is a process ID that is part of the pipeline.

How to inspect a pipeline

A pipeline is a sequence of multiple commands separated by the control operators. It is easy to understand as long as you see the whole picture, but I will show you how to inspect it when you have a single process ID.

How to distinguish standard error from regular output

Use bash redirection and process substitution to programmatically distinguish standard error from regular output.

How to send output to multiple commands

Send output to multiple commands using tee utility and bash process substitution.

How to specify the same option multiple times using Bash

Write a simple Bash shell script that will allow you to specify the same option multiple times or provide multiple arguments to a single option.

How to remotely execute shell function

Sometimes it is very convenient to define shell function and execute it remotely.

How to restart process depending on the log file modification time

Sometimes it is important to monitor log file modification time to restart the writing process when the file was not modified for defined period of time. I have already described how to check file metadata using stat utility which can be used to solve this task, but today I want to take advantage of the plain ls command.

How to inspect command before execution

It is nothing fancy, but there are situations where it is beneficial to know how to identify and inspect command before execution.

How to automatically logout user from the login shell after period of inactivity

I want to automatically log out the user from the login shell after a defined period of inactivity but leave X Window Terminals untouched. This will allow me to enhance security slightly, as I will not accidentally leave the superuser session running for a long time.

How to store last command from history

I often want to save a recently executed command to the personal log file for further reference, so let’s do it.

How to handle Bash history

I have already written a blog post about useful Bourne Again SHell key sequences, so today, I will touch on another important aspect of the daily routine – the history.

How to handle Bash command-line

The default interactive shell in Debian is Bourne Again SHell, so it worth to invest some time to at least skim through the available readline key sequences to gain higher proficiency at the command-line.