How to calculate Elasticsearch average documents number in recent days

Calculate Elasticsearch’s average documents number in recent days using a shell script. ...

How to determine SSL cipher suites supported by the web-server

Determine SSL cipher suites supported by the web-server using OpenSSL. ...

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 store the contents of every tmux pane

Store contents of every tmux pane using a shell script. ...

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 determine how long specified remote server or device was offline

Create a shell script to determine how long a specified remote server or device was offline. It is not designed to substitute monitoring solutions but to determine how long it will take to reboot the server or device. It is using convert seconds to human readable time code to display results. ...

How to avoid the two most common caveats when using read command

These are easy mistakes to make as the bash builtin read command will terminate with the error exit code on the end-of-file condition and use Internal Field Separator to split the line into words. It is kind of tricky, but it is worth knowing how to deal with such problems. ...

How to display TLS server extensions

Use openssl command-line utility to display TLS server extensions. ...

How to convert seconds to human readable time

Create a shell script to convert seconds to human-readable time. I have reused part of an old shell script used to pretty-print system uptime to built it, as this code proved to be useful on several occasions. ...

How to resolve hostname to IP address within a shell script

Create straightforward shell script to resolve hostname to IPv4/IPv6 address and reuse parts of it for other projects. ...

How to count separate line entries inside a pipe

Use a shell script to count separate line entries inside a pipe to see how many entries got filtered out. It can be useful in some scenarios, especially for testing. ...

How to perform different operations depending on the shell script name

This technique is widespread. To be honest, it is more common than I initially thought, so I will show you how to create a single shell script that will display, create or destroy a temporary file system depending on the name used to execute it. ...

How to calculate how fast data is copied to the specified directory

Determine how long it would take to copy data between directories. ...

How to manage known_hosts file using shell script

I am using a simple shell script to manage OpenSSL known_hosts file as it requires many small updates due to constantly changing host keys on a dynamic virtual server. ...

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 display days till certificate expiration

Use openssl command-line utility to calculate and display days till the certificate expiration. ...

How to display certificate issuer and dates

Use openssl command-line utility to display common name, certificate issuer, alternative names, start/end dates. ...

How to disable touchpad using shortcut

I have already described how to disable the touchpad when an external mouse is connected using the udev device manager, but today I want to share a simple shell script that I am using on Dell XPS 13 to disable/enable the touchpad using a single keyboard shortcut. ...

How to check for command inside shell script

Today, I will illustrate a simple way to check for specific command inside a shell script, which is quite simple as it uses only shell built-in command utility. ...

How to check for package inside shell script

Today, I want to briefly describe a simple way to check for a specific package inside a shell script. ...

How to search through manual pages

It was almost three years ago when I wrote about manual pages. Moving forward, I want to share a simple and useful shell script to search through manual pages. ...

How to fix Bluetooth sound synchronization

I have experienced a lot of trouble with Bluetooth sound synchronization. Most of the time, this issue was especially evident while watching movies. Fortunately, the solution is within easy reach. ...

How to automatically import NordVPN servers

A week ago, I illustrated a simple way to connect to the NordVPN server using Network Manager. Today I will describe a more advanced solution to automatically import NordVPN configuration using a shell script. ...

How to disable touchpad when external mouse is connected

I unconsciously keep my thumbs on built-in touchpad, so I decided to use external mouse and automatically disable touchpad for the time mouse is connected. ...

How to programmatically create system user with defined password

It is very easy to add users by hand, but sometimes such actions needs to be automated. ...

How to extract the cover image from an e-book

I have successfully used Google Drive and Insync to organize all of the e-books that I have acquired during the last years. Currently plan to upload them to a personal DokuWiki instance since I use it more every day. Before I can start, I need to extract cover images to ensure that I will get a decent outcome. ...

How to convert manual pages to DokuWiki

I have created a simple shell script to convert manual pages to DokuWiki as I want to have them always at hand and easily interlink to them from other pages. ...

How to pretty-print disk space used by PostgreSQL databases

I wrote a simple shell script to pretty-print disk space used by PostgreSQL databases while examining database object size functions. You can benefit from this too by inspecting used SQL statements. ...

How to exclude data from certain tables during PostgreSQL backup

I often want to omit data from certain tables during PostgreSQL database backup. Today I will look into this and post my findings for further reference. ...

How to pretty-print system uptime

It is easy to use uptime command, but custom shell script is definitely a more interesting solution as it provides more detailed information. ...

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 check the progress of dd using proc filesystem

On Sunday 29th April 2012, I have described How to check dd’s progress using User-defined signal 1. Today, I will extend this topic further using the proc filesystem. ...

How to locate scripts in the PATH

Simple shell script that will iterate through the directories in the PATH variable and print only files identified as scripts. ...

How to check external IP address

I am constantly on the move, so sometimes I need to quickly verify my external IP address, as I do not want to accidentally block myself on some kind of firewall. ...

How to check file metadata using shell script

It is well described how to verify file existence or type, but there is much more information that can be easily verified inside shell script using nothing more than simple stat command. ...

How to create simple bar charts in terminal using awk

Today, I tried to visualize how many processes each user is running using a bar chart. The catch is that I want to see results in a plain terminal, which makes things more interesting. ...

How to verify copy process

Yesterday, I left a long-running copy process between two external USB hard-drives. I did not want to assume anything, so I created a simple shell script to ensure that the whole process went smoothly. ...

How to check whether the process ID still exists

Not well documented, but a quick and simple operation. ...

How to read interface statistics on Cisco Catalyst switch using SNMP protocol

Today, I will show you how to create a simple shell script to read and print interface statistics on the Cisco Catalyst switch using the SNMP protocol. ...

How to terminate PostgreSQL sessions

Recently, I have encountered an interesting issue, as I could not perform specific database operations due to unwanted and active sessions using the database. Thus, I will briefly note the solution for further reference. ...

How to forbid script execution from different directory

Today I have found an interesting issue as I tried to forbid shell script execution from different directory. ...

How to archive every directory in current location

Today I needed to archive every non-hidden directory in several different locations. I do not like to repeat myself so after a while I quickly created shell script to accomplish this task. ...

How to count local user accounts

If you are wondering how to count only local users ignoring system accounts, I will give you a concise and straight answer. ...

How to remotely check PostgreSQL version

Today I will shortly describe how you can remotely check the PostgreSQL version and use it inside shell scripts. This ability comes in handy at times, as it can be used to perform different tasks depending on the returned database version. ...

How to colorize text in terminal

Seven days ago I have published a shell script to highlight text in the terminal using sed or ssed. Today I want to extend the idea and colorize specified strings or simple regular expressions using just bash, getopts and ssed respectively. ...

How to highlight text in terminal

I have been working on a simple shell script to highlight text in the terminal for the last hour. At first, I looked at it from the wrong angle, but after a short break, I finally realized the simplest possible solution. ...

How to open Firefox bookmarks from OpenBox menu

I have recently switched to OpenBox, so today, I will use dynamic menus to integrate Firefox bookmarks with an existing OpenBox menu. ...

How to generate directory index files

Recently I needed a simple utility to generate index files at briefcase.sleeplessbeastie.eu, so after a while, I came up with two simple solutions, each of which has different strengths and weaknesses. ...

Handy way to beep within a shell script

Sometimes I need to explicitly indicate execution of specified shell script or just action taken inside it. My favorite way is to use advanced pc-speaker beeper, which is directly available in Debian repository. ...

How to list local displays

I was always curious about how to list local displays as it is quite interesting issue. Solution is not immediately apparent, but easy enough to spot after a while as it does not require anything more than little observations. ...

How to convert date to Julian Day Number using shell script

I was wondering how to calculate Julian Day Number as I will need it to determine the sunrise and sunset times. Algorithms are extensively described so I will just point you to the two most useful pages – Julian day/Wikipedia and Julian Day Numbers/UT. ...

How to open manual page at the specific page section

After writing the previous blog entry, I started to think about how to specify page section when opening the manual page. It is a simple but quite interesting issue, so I quickly got curious and wrote this post to describe a straight solution. Just to be clear – I need to mention that I am not writing about section numbers describing distinct subject areas but just page sections, such as NAME, SYNOPSIS, DESCRIPTION, AUTHORS, and so on. ...

How to read total CPU usage of the group of processes

I was wondering how to read the total CPU usage of the group of processes. Then I came with a straightforward solution using top and awk commands. ...

Simple shell script to backup selected directories

A couple of months ago, I published a short script to backup MySQL databases. Today I created a simple shell script to backup selected directories. ...

Semi-intelligent screensaver

A couple of days ago, I described a couple of interesting ways to interact with KDE using the D-Bus message bus. Today I will show how to set up a semi-intelligent screensaver to just wait during YouTube video playback. ...

How to automate KDE using D-Bus

Today I was playing with D-Bus message bus and KDE so I will describe here couple of basic actions that can be quickly automated by using shell commands. It shouldn’t matter much but I need to mention that I am using KDE 4.9.5. ...

How to automate mouse and keyboard

Recently I was wondering if it would be possible to automate mouse and keyboard actions. The answer is obviously yes as you can use xautomation and xdotool tools. I will describe them in a couple of simple examples. ...

How to automatically set up external monitor

Recently I was wondering how to automatically set up an external monitor without using desktop utilities as I don’t like to configure it each time. This question provided me a lot of fun as it opens a couple of interesting possibilities. ...

How to monitor battery capacity

Recently battery in my notebook started to behave erratically. It will charge only to 70-80% of its maximum capacity. I suspect that it is probably slowly dying, so I will have to replace it soon, but at first, I will look at several utilities to monitor battery capacity. ...

Simple shell script to backup MySQL databases

Simple shell script to backup MySQL databases. ...

How to remove comments from a shell script

The easiest way to remove comments from a shell script is to use sed (stream editor for filtering and transforming text) command. ...

How to determine when daylight saving time changes

When you’re not sure when daylight saving time changes you can quickly check it using the zdump command which is available on every *nix system. ...

Create web thumbnail for SemanticScuttle using cutycapt

This simple script will create web thumbnail using cutycapt console command. ...

How to do some work in each active jail (FreeBSD7)

Execute a set of commands inside each active jail. ...

Simple script to create new jail in FreeBSD

Create shell script to create image based jail in FreeBSD 7. ...

How to split files by size and merge them

Lets say that we have one big file and want to split it into 10M parts. ...

Scripting SPS switches

Managing SPS switches could be real fun if you use expect to automate such tasks. ...

How to downscale video for your portable device

Sometimes I need to downscale video for a portable device. ...

How to get rid of spaces in filenames

Get rid of spaces in file/directory names. ...

Using KDE notification area within a shell script

Using KDE notification area within a shell script gives a lot of useful possibilities as you can easily display feedback from running services, other scripts, log analyzers. ...