Display a scheduled Hugo posts using shell-script.
Calculate Elasticsearch’s average documents number in recent days using a shell script.
Determine SSL cipher suites supported by the web-server using OpenSSL.
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.
Parse INI configuration file using Bash shell-script.
Store runtime configuration within shell script using simple but an effective method.
Store contents of every tmux pane using a shell script.
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.
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.
Use bash redirection and process substitution to programmatically distinguish standard error from regular output.
Send output to multiple commands using tee utility and bash process substitution.
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.
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.
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.
Use openssl command-line utility to display TLS server extensions.
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.
Create straightforward shell script to resolve hostname to IPv4/IPv6 address and reuse parts of it for other projects.
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.
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.
Determine how long it would take to copy data between directories.
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.
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.
Use openssl command-line utility to calculate and display days till the certificate expiration.
Use openssl command-line utility to display common name, certificate issuer, alternative names, start/end dates.
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.
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.
Today, I want to briefly describe a simple way to check for a specific package inside a shell script.
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.
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.
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.
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.
It is very easy to add users by hand, but sometimes such actions needs to be automated.
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.
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.
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.
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.
It is easy to use uptime command, but custom shell script is definitely a more interesting solution as it provides more detailed information.
I often want to save a recently executed command to the personal log file for further reference, so let’s do it.
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.
Simple shell script that will iterate through the directories in the PATH variable and print only files identified as scripts.
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.
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.
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.
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.
Not well documented, but a quick and simple operation.
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.
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.
Today I have found an interesting issue as I tried to forbid shell script execution from different directory.
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.
If you are wondering how to count only local users ignoring system accounts, I will give you a concise and straight answer.
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.
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.
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.
I have recently switched to OpenBox, so today, I will use dynamic menus to integrate Firefox bookmarks with an existing OpenBox menu.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
The easiest way to remove comments from a shell script is to use sed (stream editor for filtering and transforming text) command.
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.
This simple script will create web thumbnail using cutycapt console command.
Execute a set of commands inside each active jail.
Create shell script to create image based jail in FreeBSD 7.
Lets say that we have one big file and want to split it into 10M parts.
Managing SPS switches could be real fun if you use expect to automate such tasks.
Sometimes I need to downscale video for a portable device.
Get rid of spaces in file/directory names.
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.