Taming Duplicate Entries in Your Bash History with a Simple Script

Introduction to Bash History

As a long-time Linux user, I’ve come to rely on the command line to get my work done. The Bash shell is an incredibly powerful tool, and one of its most useful features is its ability to store a history of previously executed commands. This history is stored in the ~/.bash_history file and can be accessed using the history command. However, as our systems see more use, the Bash history can become cluttered with duplicate entries, making it tough to find the commands we need.

[Read More]

Recovering from a Failed Boot: Using systemd's Emergency Mode and Rescue Shell to Troubleshoot Initramfs Issues

Introduction to Emergency Mode and Rescue Shell

When your Linux system fails to boot, it can be frustrating - especially if you’re not familiar with the troubleshooting process. I’ve seen this go wrong when people don’t know where to start. Luckily, systemd’s Emergency Mode and Rescue Shell are here to help. In this article, we’ll dive into how to use these tools to troubleshoot initramfs issues and get your system up and running again.

[Read More]

Using SSH Keys with Multiple Accounts on a Single Remote Server

Introduction to SSH Keys with Multiple Accounts

I’ve seen this go wrong when people try to manage multiple services or projects on a single remote server - they end up with a mess of passwords and login issues. Using SSH keys with multiple accounts is a much better approach. It allows for secure, passwordless login to different user accounts on the same server, which is particularly useful for sysadmins, developers, and self-hosters.

[Read More]

Taming Shared Directory Chaos with Setgid, Sticky Bits, and ACLs

Introduction to Shared Directory Management

I’ve seen shared directory management become a nightmare on Linux systems, especially when dealing with complex permission scenarios. Luckily, Linux provides some useful tools to simplify this process, including setgid, sticky bits, and Access Control Lists (ACLs). These features give you fine-grained control over file and directory permissions, ensuring that users and groups have the necessary access without compromising security.

Setgid and Sticky Bits

Setgid and sticky bits are special permission bits that can be set on directories. The real trick is understanding how they work together. The setgid bit, when set on a directory, ensures that all files created within that directory inherit the group ownership of the directory. This is particularly useful in shared directories where multiple users need to collaborate on files. Don’t bother with the setgid bit if you’re working with single-user directories, though. The sticky bit, on the other hand, prevents users from deleting or renaming files they do not own, even if they have write permission to the directory.

[Read More]

Using systemd to Manage and Rotate Log Files Without Running Out of Disk Space

Introduction to Log Rotation with systemd

I’ve seen log files consume all available disk space, bringing systems to a grinding halt. That’s why log rotation is a crucial aspect of system administration. With systemd becoming a de facto standard for managing system services and logs on many Linux distributions, I’ll explore how to use it to manage and rotate log files efficiently.

Understanding systemd-journald

systemd-journald is the system service that collects and stores log messages from various sources, including system services, kernel messages, and user applications. By default, journald stores log messages in a binary format, which can be queried using the journalctl command. To manage log rotation, we need to understand how journald handles log storage and rotation. Don’t bother with manually rotating log files - journald can handle it for you.

[Read More]

Using Find and Xargs to Safely Remove Unused Packages on a Crowded Linux System

Introduction to Find and Xargs

I’ve seen many Linux systems become cluttered over time, making it harder to manage packages and maintain security. That’s where find and xargs come in - two powerful command-line tools that can help you clean up your system. In this article, I’ll show you how to use these tools to safely remove unused packages on your Linux system.

Understanding Find and Xargs

The find command is incredibly versatile, allowing you to search for files based on various conditions like file name, size, modification time, and more. xargs, on the other hand, builds and executes command lines from standard input. By combining these two tools, you can automate the process of finding and removing unused packages. Don’t bother with manual searches - find and xargs can save you a lot of time and effort.

[Read More]

Troubleshooting SSH Connection Issues with Unknown Hosts and Missing Host Keys

Introduction to SSH Connection Issues

I’ve seen my fair share of SSH connection issues over the years, especially when dealing with new servers or changes in network configurations. Secure Shell (SSH) is a fundamental tool for remote access and management in Linux, but issues with unknown hosts and missing host keys can be a real headache. Understanding how to troubleshoot and resolve these issues is crucial for efficient system administration and security.

[Read More]

Debugging Connectivity Issues with resolvectl and ss: A Step-by-Step Guide to Identifying DNS and Routing Problems

Introduction to Debugging Connectivity Issues

I’ve seen this go wrong when dealing with connectivity issues on Linux systems: not knowing where to start. Two essential tools can save you a lot of time - resolvectl and ss. These tools help in identifying and troubleshooting DNS and routing problems. Let’s dive into a step-by-step guide on how to use them, focusing on practical examples and security considerations where relevant.

Understanding resolvectl

resolvectl is a command-line utility provided by systemd for querying and configuring the DNS resolver. It’s incredibly useful for controlling the DNS resolver, including setting DNS servers, querying the DNS cache, and configuring DNS over TLS (DoT) or DNS over HTTPS (DoH). To get started with resolvectl, you can use the following command to status the current DNS configuration:

[Read More]

Resolving Dependency Conflicts with apt-pin on Debian-Based Systems

Introduction to Dependency Conflicts

I’ve seen this go wrong when updating packages on Debian-based systems - dependency conflicts can be a real headache. In 2025, many users faced problems with package updates due to these conflicts, and as of 2026, it’s still a crucial issue to understand how to handle them for maintaining a stable and secure system.

Understanding apt-pin

The real trick is using apt-pin to pin packages to specific versions, which can help resolve these conflicts. By pinning a package, you ensure it remains at a specific version, even when newer versions are available. This is particularly useful when a newer version introduces a dependency conflict.

[Read More]

Extracting Valuable Data from Systemd Journal Logs with jq and grep

Introduction to Systemd Journal Logs

I’ve worked with Linux systems for years, and one of the most powerful tools at my disposal is systemd journal logs. These logs provide a centralized location for logging system events, making it easier to troubleshoot and diagnose issues. By default, systemd stores these logs in a binary format, which can make them a bit tricky to parse and analyze. However, with the help of tools like jq and grep, you can extract valuable data from these logs.

[Read More]