Explains how to check if a bash shell script is being run or executed by the root user account under Linux, macOS, Unix and BSD.
Source: How to check the bash shell script is being run by root user or not – nixCraft
Explains how to check if a bash shell script is being run or executed by the root user account under Linux, macOS, Unix and BSD.
Source: How to check the bash shell script is being run by root user or not – nixCraft
Explains how to check the health status of a USB stick in Linux for bad sectors and verify if you have bought a fake flash drive.
Source: Linux check the physical health of a USB stick [ Flash drive ] – nixCraft
In this tutorial, you will install the latest version of Mastodon, which is 4.0.2 at the time of this writing. You will configure the official Mastodon install repository, and set up the environment to install all other dependencies. Using the interactive setup, you will set up your custom Mastodon instance for storage, email, assets, and your administrator account. Finally, you’ll secure your instance with SSL/TLS certificates through Let’s Encrypt.
Source: How To Install Mastodon on Ubuntu 20.04 | DigitalOcean
Jack Wallen walks you through the process of installing and using the Portmaster network monitor so you can better manage the security of your system on a per-app basis.
Source: How to install and use the Portmaster cross-platform network monitor
Linux uses PulseAudio, which has a poor default configuration, resulting in bad sound.
With some tinkering with the PulseAudio file, reading a lot of websites about the settings, I was able to get PulseAudio to have sound that’s subjectively as good as BSD, Mac, etc. By default, PulseAudio uses a resampler called “speex-float-1” which is horrendous. The reason this is chosen is to maintain compatibility on very small and bad sound cards. This shall be reconfigured to either “speex-float-10” or “soxr-vhq” for best quality. Some other changes also improve the sound.
Make the Sound Good (Reddit | r/linuxmint)
Also see: PulseAudio (Linux Reviews)
A ramdisk – or if you prefer, RAMdisk – is a method of taking a section of memory and treating it as disk. If you think about it for a moment, the pros/cons should be obvious: RAM is much faster than even the fastest disk, so operations on the ramdisk are much faster…
Source: Ramdisks: Why You Might Enjoy One, Plus a Performance Puzzler – LowEndBox
SCP is short for secure copy protocol and is used to copy files and directories between multiple Linux machines over a network. The data transferred using SCP is encrypted to protect your data against nefarious agents.
The SCP command uses SSH for data transfer and thus uses all the same usernames and passwords you would use for SSH. As a result, it is an extremely useful command for transferring files securely without too much added complexity.
In the course of my career, I’ve periodically come across code like this in shell scripts:
TEMP_FILE=/tmp/tempfile
Or sometimes, slightly more elegantly:
TEMPFILE=/tmp/tempfile.$$
The problems with the first example are obvious, especially if it appears in many different scripts. The second is better. The “$$” means “my process ID”, who if whatever script had a process ID of 5309, the TEMPFILE variable would be set to /tmp/tempfile.5309. This makes collisions between scripts extremely unlikely, but is still suboptimal. What if there is a file called /tmp/tempfile.5309 and it’s owned by another user, or what if you don’t have permission to write to /tmp? It’d be better to find out immediately than many lines later when you try to write something. …
Source: Here Today, Gone When You Exit: Proper Tempfiles in Shell Scripts – LowEndBox
The cp command is ideal for copying files and directories on a Linux or Unix distribution. You will likely not need to use additional options for most tasks as the basic command will achieve most requirements.
This tutorial will take you through several use cases for using cp on a Linux distribution. For example, we cover copying single files, copying multiple files and directories, setting backups, copying recursively, and much more.
The following concepts modernize your automation scripts with some lesser-known modern Bash scripting techniques.
Source: 5 Modern Bash Scripting Techniques That Only A Few Programmers Know | Level Up Coding
Recent Comments