Month: September 2026

How to remove an unwanted audio stream from an MP4 file

Let’s assume that an MP4 video file has two audio streams, but you only want to keep one.

The following line will create a new mp4 video file that only has the first audio stream:

ffmpeg -i input.mp4 -map 0:v:0 -map 0:a:0 -c copy output.mp4

The following line will create a new mp4 video file that only has the second audio stream:

ffmpeg -i input.mp4 -map 0:v:0 -map 0:a:1 -c copy output.mp4


(Last update on September 19, 2026 was done by Editor F.)

Check if a file is a valid JSON in a BASH script

So, you have downloaded a file that is supposed to be a JSON. Before processing the file, it might be wise to check if that file is actually a valid JSON file.

Here is how to check if a file is indeed a valid JSON file:

if jq empty $File 2>/dev/null; then
  ThisFileIsAValidJSONFile="true"
else
  ThisFileIsAValidJSONFile="false"
fi 


(Last update on September 2, 2026 was done by Editor F.)

Activate maintenance mode for nextcloud from BASH command line

Sometimes, one wants to put a nextcloud installation into “Maintenance mode” from the command line. Assuming your nextcloud is installed in /var/www/nextcloud/, the following command will put it in maintenance mode:

sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on

The following command will deactivate maintenance mode:

sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off

If you want to check the state of maintenance mode:

if [ "$(sudo -u www-data php /var/www/nextcloud/occ status | grep -c "maintenance: true")" != "0" ]; then
  echo "Nextcloud is in maintenance mode"
else
  echo "Nextcloud is not in maintenance mode"
fi

(Last update on September 2, 2026 was done by Editor F.)

Activate maintenance mode for yourls from BASH command line

Sometimes, one wants to put a yourls installation into “Maintenance mode” from the command line. Assuming your yourls is installed in /var/www/example.com/x/, the following command will put it in maintenance mode:

touch /var/www/example.com/x/.maintenance

The following command will deactivate maintenance mode:

rm -f /var/www/example.com/x/.maintenance


(Last update on September 1, 2026 was done by Editor F.)

Activate maintenance mode for wordpress from BASH command line

Sometimes, one wants to put a wordpress installation into “Maintenance mode” from the command line. Assuming your wordpress blog is installed in /var/www/myblog.example.com/, the following command will put it in maintenance mode:

echo '<?php $upgrading = '"$(date +%s)"'; ?>' > /var/www/myblog.example.com/.maintenance

The following command will deactivate maintenance mode:

rm -f /var/www/myblog.example.com/.maintenance


(Last update on September 1, 2026 was done by Editor F.)