Recent Posts

Featured image for CLI Remove old backup file max 5 older

CLI Remove old backup file max 5 older

We have provided a set of command-line instructions for managing backup files. These commands are designed to remove older backup files based on certain criteria. Let me break down each of the commands for you:

  1. Removing Old Backup Files Using ls, tail, and xargs:

    shell
    1
    
    ls -t1 | tail -n +11 | xargs -d '\n' rm

    This command is used to list files in a directory by their modification time in descending order (-t1). Then, it uses tail to exclude the top 10 files (keeping the 11th and onwards), and finally, it uses xargs to remove these older files.

  2. Removing Old Backup Files Using rm and ls:

    shell
    1
    2
    3
    
    cd /DataVolume/shares/john/Backups/DockerBackup/example-server
    rm -f `ls -t ??-??-??.tgz.gpg | sed 1,5d`
    cd ~

    This set of commands does the following:

    • It navigates to the specified directory.
    • It lists files matching the pattern ??-??-??.tgz.gpg in descending order of modification time using ls -t.
    • It uses sed 1,5d to remove the first 5 lines (files) from the list.
    • Finally, it removes the remaining files using rm.
  3. Using the ‘drive’ CLI to Push and Delete Backup Files:

    shell
    1
    2
    
    drive push --no-prompt -destination backups/example-server/Dockers/ *.gpg
    drive delete --quiet `drive list --files backups/example-server/Dockers/ | grep gpg | cut -c 2- | sed 1,5d`

    These commands involve the “drive” CLI for interacting with Google Drive. Here’s what they do:

    • The first command pushes all *.gpg files from the current directory to the specified destination in Google Drive, without prompting for confirmation.
    • The second command deletes the oldest 5 *.gpg files in the “backups/example-server/Dockers/” directory on Google Drive. It lists the files, filters for those with “gpg” in their names, removes the first 5 files using sed, and then deletes them using drive delete.
Featured image for Updating Video Metadata Based on Modified Date Using Exiftool

Updating Video Metadata Based on Modified Date Using Exiftool

In this article, we’ll explore how to update the metadata of video files (in this case, MP4 files) based on their modified date using the powerful Exiftool command-line utility. Metadata can include various information about the video, such as creation date, author, and more. Sometimes, it’s necessary to adjust or correct this metadata. Here, we’ll focus on modifying the date-related metadata using Exiftool.

Prerequisites

Before you begin, make sure you have Exiftool installed on your system. You can download it from the official website: Exiftool

Featured image for Pulling the Latest Versions of All Docker Images

Pulling the Latest Versions of All Docker Images

In Docker, it’s essential to keep your images up to date, especially when using various containers and applications. One way to do this efficiently is by pulling the latest versions of all Docker images with a single command. In this article, we’ll walk you through the process using a command-line interface (CLI).

Prerequisites

Before proceeding, make sure you have Docker installed and configured on your system. You can download and install Docker from the official website: Docker Download.

Featured image for Updating and Upgrading Brew Cask Apps via Command Line Interface

Updating and Upgrading Brew Cask Apps via Command Line Interface

If you’re a macOS user who relies on Homebrew and Brew Cask for managing software packages and applications, keeping everything up to date is crucial. This guide outlines how to update and upgrade Brew Cask apps through the command line interface (CLI). Follow the steps below to ensure that your software is always current.

Prerequisites

Before you start updating and upgrading your Brew Cask apps, make sure you have already updated Homebrew itself. To do this, open your terminal and run:

Featured image for Disabling Auto Traffic Promotion in Google Cloud App Engine

Disabling Auto Traffic Promotion in Google Cloud App Engine

When deploying applications to Google Cloud App Engine, you might want to disable the automatic traffic promotion feature, which promotes the latest deployed version to receive 100% of the traffic by default. This can be useful when you want to manually control when a new version of your application should start receiving traffic. To disable auto traffic promotion, you can use the following command in your terminal:

bash
1
$ gcloud config set app/promote_by_default false

This command configures your Google Cloud CLI (gcloud) to not automatically promote the latest deployed version. Here’s what each part of the command does: