While writing commands or scripting in bash, you often need to assign long strings to variables or as arguments for commands. But strings are problematic – you often need to either expand or prevent the expansion of arguments, you sometimes need to split them across multiple lines, and they often look ugly if you need […]
Category: Linux Command Line
Symbolic Links vs Hard Links in Linux
Linux offers various methods for referencing files and directories through other files and directories, without creating copies of the original. If you have color coding enabled in your bash terminal, you might have seen some folders full of files of a different color from regular files. There’s a good chance that these are all symbolic […]
Dealing with Cron Job Logs in Linux
Regardless of whether you’re just getting started with Linux or if you’ve been using it for a while, you already know what cron jobs are. At NameHero, we’ve already written a number of tutorials, including on how to list cron jobs and how to create repeating cron tasks. But in addition to creating cron jobs, […]
Differentiating the df vs du Commands in Linux
Both df and du are Linux commands for estimating disk usage, but they differ in their focus. Df stands for “disk free”, and du stands for disk usage. The first shows the amount of free space available on a volume, and the second shows the amount of space used by specific directories. Both commands have […]
Git Bisect: A Step-by-Step Tutorial
At NameHero, we’ve looked intensively at git, and what an amazing tool it is for all kinds of projects – not necessarily, but primarily for coding. Last week, we saw how to clean up git commit history using rebase, and while we’re on the subject of commits, this is a good time to look at […]
How to Use Git Rebase Interactive to Manage Commits
The first time you truly grasp the potential of git, it seems like magic. It seems that this is a structure for projects that goes beyond just coding, but one that can be applied to any evolving set of text-based files, like documents, meeting notes, and more. Those just starting with git tend to be […]
How to Use set -e -o pipefail in Bash, and Why
There are a ton of best practices in Linux scripting that a lot of people ignore. For example, while a lot of people use git, it’s often used unoptimally by those treating it as just a fancy way of saving their work, rather than using it for atomic changes and branches for features. Similarly, many […]
How to Use Bash Getopts to Pass Arguments to Scripts
Scripting is an integral part of Linux. As an admin, you’ll soon find yourself using scripts to automate tasks for your specific needs. In an earlier tutorial, we saw how to execute a bash script. But scripts can be even more powerful. Instead of simply being standalone logic that performs set tasks, you can expand […]
How to Use the Tee Command in Linux
The tee command in Linux has a long pedigree, being developed way back in 1973. The fact that it’s been around for so long is a testament to its usefulness. But what’s even more surprising is how little it has changed since then. Linux’s philosophy of “do one thing and do it well”, has served […]
Nmap Scan Types: How to Scan a Server’s Network
In server security, you often need to perform a regular audit of your server, or one belonging to someone else to see what devices are connected to it. In this context, “devices” doesn’t just mean peripherals like keyboards, mice etc, which in any case are irrelevant for most servers, but also mounted devices, open ports, […]
