How To Disable SSH reverse DNS Lookups in Linux/Unix system

By default, ssh server performs a reverse DNS lookup for authentication requests. This can be so annoying as you wait ten’s of seconds for the lookup to finish. You may experience a delay before receiving a password prompt while accessing a remote system via ssh.

This guide will show you how to disable SSH reverse DNS lookups in a Linux/Unix system. The method discussed here works for all Linux and Unix based operating systems running OpenSSH Server.

Source: How To Disable SSH reverse DNS Lookups in Linux/Unix system – Computing for Geeks

How to use rsync command on Linux/Unix with examples

From the man page of rsync, Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination.

Source: How to use rsync command on Linux/Unix with examples – Computing for Geeks

How to use scp command to securely transfer files with examples

Introduction The scp command is used to copy files and directories between one computer to another. What is valuable about this utility is the fact that it used ssh to tunnel the copying. This means that the data is encrypted because it rides on ssh’s secure features.

Source: How to use scp command to securely transfer files with examples – Computing for Geeks

Guide to Sort Files by Date Using LS Commandline in Linux

The ls command is used to list directory contents and the results can be sorted upon several criteria such as by date, alphabetical order of filenames, modification time, access time, version and file size.

In this article, I will show you how to sort files by date using ls command in Linux.

Source: Guide to Sort Files by Date Using LS Commandline in Linux (LinOxide)

How to stop a bash script from being executed too frequently

Every so often something really useful appears on Reddit, and this is such a case.  You may encounter a situation where you want to execute the contents of a bash script, but not more frequently than every few seconds.  A Reddit user wanted to know How to check if a command in .bashrc has been executed within last 10 seconds if yes don’t execute the command again. The response by Reddit user mdaffin is brilliant in its simplicity, and can be used in any bash script where you don’t want the contents executed too often:

Write a time stamp to some file, check said file before you run the command if now – timestamp > 10s run the command and update the timestamp.

EDIT: Like this (with modification times instead):

TS_FILE="$HOME/.cache/your-app-lock"
if [[ ! -f "$TS_FILE" ]] || [[ "$(expr "$(date +%s)" - "$(stat -c %Y "$TS_FILE")")" -gt 10 ]]; then
touch "$TS_FILE"
echo "running"
fi

You’d replace the echo "running" line with the part of the bash script you want to run only if it’s been 10 seconds since the last time the script was run, or whatever number of seconds you specify after the -gt. If the bash script actually outputs a file as part of its normal operation then you could specify that file in the TS_FILE= line; there would be no need to create a separate timestamp file (unless some other process could also modify that same file).

This doesn’t actually stop the bash script from running; it just prevents it from executing the part of the script that you don’t want executed too frequently. This could be very useful in a situation where without such protection, the too-frequent execution of the script might cause something undesirable to happen (such as getting locked out of an online site for hammering it with requests). Depending on the situation there may be other, perhaps even better ways to avoid this possibility, but in other cases this may indeed be the best approach.

How to Remove Stuck Time Machine Backups from Mac Trash Due to System Integrity Protection Error

If you’re trying to remove a Time Machine backup from a drive and find that it’s stuck in the Mac Trash with a specific error message stating the trash can’t be emptied because “Some items in the Trash cannot be deleted because of System Integrity Protection”, then read on to learn how to resolve this particular Time Machine backup removal problem.

Source: How to Remove Stuck Time Machine Backups from Mac Trash Due to System Integrity Protection Error

Convert an older model USB printer to a networked printer using a Raspberry Pi or other Linux-based computer — also works well for making an older printer compatible with a newer version of MacOS

We originally set out to do this because we were having problems getting an older model laser printer, specifically a Konica Minolta PP1350W, to work with MacOS High Sierra (10.13). With previous versions of MacOS we’d been able to connect the printer directly to the computer, and with some fiddling with drivers and other software, get it to work. But newer versions of MacOS seem to be far less tolerant of this, and we had a spare Raspberry Pi, so the idea came to us to use the Raspberry Pi as a bridge between the printer and any computers on the local network from which we wanted to be able to print. The bonus is that the printer is no longer tethered to a single machine, but instead can potentially be used by any computer on the local network.

You do not need to have a Raspberry Pi to make this work – any computer that can run Linux will do. And of course the Raspberry Pi or other Linux computer can be used for other purposes besides this. We do not guarantee that this technique will work for every older printer out there, but this will work with a surprising number of them.

Source: Convert an older model USB printer to a networked printer using a Raspberry Pi or other Linux-based computer — also works well for making an older printer compatible with a newer version of MacOS – Two “Sort Of” Tech Guys