Getting the Age of a File in Days in Bash

Gatting the age of a file in days is sometimes useful in scripts.

The date +%s command will give the current time in epoch seconds. It can be handily combined with -r, which causes date to use the modification time of a file rather than the current time. For example:

$ ls -l /etc/hosts
-rw-r--r-- 1 root root 3031 Mar 22 20:23 /etc/hosts

Our hosts file was last modified on March 22nd.  Converting that date to "epoch" time, gives us the age of the file (since Jan 1970), in seconds:
Continue reading

VMware Disconnection Caused by Network Manager Connectivity Check

A Windows virtual machine running under VMware 17 Pro was freezing several times a day, seemingly due to a brief network outage. The cause was found to be a Network Manager setting on the host computer, a laptop running Linux Mint 21.2. As explained below, the fix was to disable connectivity checking in the NM configuration, which is on by default, while noting the side effect of disabling captive portals.

Continue reading

Install and Optimize Linux Mint 21

This article is about installing and optimizing Linux Mint. The focus is on Mint 21, but it’s relevant to all versions. The best disk layout is discussed at the end of the article.

Install vs Update

If Mint is already installed on your system, then updating to the latest version is an option. I would recommend updating between minor versions, but for major versions, a fresh install is better.

Continue reading

Connect a Second Monitor to Linux Mint with a USB to HDMI Adapter

Having a second or even a third monitor attached to your PC gives a helpful increase in screen space. Being able to have more windows and applications visible at once improves productivity and can reduce the stress of computer usage.

Generally, the number of screens is limited by the number of PC interfaces. Especially for laptops, which often have fewer ports than desktop/tower systems. Fortunately, the number of monitor ports can be increased by the addition of a simple adapter. For Windows users it’s easy. For Linux users, well it is quite easy too, as this article explains.

Continue reading

How to Find the Time Between two Unix Time Stamps

This article explains how to find the time interval between two Unix time stamps. The default time format in Unix is like this: “Sun 9 Aug 12:50:08 BST 2020”. It appears in many places on the system and is the default produced by the “date” command.

For example, it might appear in application log files, like this::

Start time: Sun 9 Aug 10:05:00 BST 2020
End Time:   Sun 9 Aug 12:51:12 BST 2020

This article explains how to subtract one time from the other in Bash, and obtain the intervening time in seconds.

Continue reading

Install Docker on Raspberry Pi

This article explains how to install Docker on a Raspberry Pi, how to build a simple image, and how to run a container based on it.

Update 20/9/22: This procedure has been updated and tested successfully on RaspiOS “Bullseye”, release date 2022-09-06 (lite version).

Docker provides a mobile execution environment in which to run software. It is a very popular container technology. Docker is useful in the rapid deployment of applications and in application isolation. It is a valuable tool for developers, users and systems administrators. In this procedure, it will be used to install a simple video processing application called “comskip“.

Although the article is entitled Install Docker on Raspberry Pi, this procedure will work unaltered on most Linux distros, which is one of the advantages of Docker.

Besides acting as a demonstration for those wanting to learn about Docker, this article is aimed at readers of my previous articles How to Watch and Record Live TV with a Raspberry Pi and How to Install Comskip on a Rasperry Pi (without Docker).

Continue reading

Interrupted System Call with CIFS Mount on Kernel 5.3.0

The above kernel causes previously working CIFS mounts to fail with an “interrupted system call” error. A Linux system which had been using a NAS share for years acquired the new kernel on 17th March 2020 and the mount became unstable thereafter.

Update. Resolved 13th June 2020. The issue was not seen again after an update to kernel version 5.3.0-53.

Continue reading

How to Install Comskip on a Raspberry Pi

The raspberry Pi makes a good platform for watching Live TV. Software packages like TVHeadend, OSMC/Kodi, NextPVR and Plex allow you to turn a normal Pi into a powerful media centre.

Recording your favourite TV shows is great, as is being able to skip through commercial breaks on playback. Every time an ad break arrives, just press “fast forward” a few times and hey presto, you are watching the next part of the show. You still have to actually press the button though, and sometimes rewind too, if the break is overshot. However, there are software tools that will skip the breaks for you, and one of these is Comskip.

This procedure explains how to install Comskip on a Raspberry Pi, with examples pertaining to TVHeadend. You might have come here from my earlier article “How to Watch and Record Live TV on a Raspberry Pi“, to which this article is an effective continuation. Or you might have some other existing system to which you want to add comskip. Even if you are using a different backend, like Plex, this article should still be useful.

Continue reading

USB Disk Errors on Mint 19 VMware Guest

Connecting a physical USB device to a virtual machine is sometimes tricky. Virtual machines are not really designed for physical interaction. In this case, it was necessary to mount a 1 TB external USB disk to a VMware virtual machine running Linux Mint 19.3. USB errors were seen and the disk would not connect. The fix was very simple.

Connecting the Disk

A USB disk was connected to a Linux laptop running VMware Workstation 15.5.1, and hosting a Linux Min 19.3 guest. When the connection “button” (at the bottom right of the VMware window) was pressed, these errors appeared in the guest’s kernel log:

Continue reading