Tag Archives: shell script

Shell Script: Check If Weekday

shell script

There are two ways to perform a “is it a weekday” logic in shell scripts. One way is to use cron. The other is to get the day of week from the date command.

Shell Script: Epoch Time to Human Readable Time

shell script

Log files are sometimes written with epoch timestamps. To analyse the log file entries, we will first need to convert the time to a human readable format. In this article, we will look at a few available methods to convert the epoch time to real time or human readable time.

Unix / Linux: Run Cron Jobs on Last Day of Month

unix linux

Cron jobs can be scheduled based on minute, hour, day of month, month or by the day of the week. Flexible as it may seem, there is actually no simple way to schedule a job to be run on the last day of every month.

Shell Script: Get Epoch Time

shell script

Unix time, POSIX time or Epoch time is defined as the number of seconds that have elapsed since 00:00:00 January 1, 1970 UTC. There are a few methods to retrieve the Epoch time on Unix and Linux.

How to Debug a Shell Script

shell script

One of the most common questions asked by a new sysadmin or UNIX user is: How to debug a shell script?

How to Sleep in Shell Script

shell script

Sometimes you will need to pause execution for a specific period within a shell script. To do that, you will need to use the sleep command to delay for a specified amount of time in seconds, minutes, hours or days.

Shell Script to Get Last Character of a String

shell script

There are a couple of ways to extract the last character of a string within a shell script. The easiest way is if you are working on bash shell – as bash will get the job done without the help of any external utilities.

How to Decrypt WhatsApp crypt5 Database Messages

A couple of weeks back, WhatsApp introduced a new way of encrypting the backup messages saved on the SD card. The article that I wrote last month on decrypting the WhatsApp messages will no longer work on the new crypt5 files.

How to Execute Shell Script on Logout

Sometimes I need to run a cleanup script automatically once I logout from a Linux or UNIX system. I normally use the script to cleanup my own temporary files.