Quarrying
Charly's Column – Smorgasbord
Sys admin columnist Charly Kühnast has an electronic note box in which he collects ideas and small snippets of code. He calls it his "quarry" and is taking this opportunity to offer up some collectors' items to regular readers.
My life as a geologist started at a time before Git. Originally, I collected code in my "quarry" if I suspected I would need it again one day. Meanwhile, I hoard artifacts from configuration files, keyboard shortcuts that I can't remember for various shells, and names of tools I want to try.
Usually, none of them appear on this page, because each note contains no more than a few lines of text. That's a pity, so today I'm serving up a wildly mixed selection of notes in the hope that everyone will find something new.
The first note is a configuration snippet for Postfix. Many readers will be familiar with email featuring subject lines straight out of hell:
AW:Re:AW:Answer:Re:AW: <Subject>
The following line, built into Postfix's header_checks.cf
, shortens the mess to a civilized re: <Subject>.
/^Subject:\s*((Re|AW|Answer):\s*)+(.*)$/REPLACE Subject: Re: $3
Sys admins live in the shell, mostly Bash. There, they often have to do things with root privileges. Switching there, be it permanently (su
) or just once (sudo
), is annoying. The Bash alias
alias iddqd='sudo su -'
not only saves a few characters, but also proves that its initiator is, first, a nerd with dubious humor and, second, no longer a young man. (The sequence iddqd enabled God Mode in the Doom shooter game in 1993).
The next alias does things in a different, but also smart, way:
alias but='history -s sudo $(history -p \!\!) && sudo $(history -p \!\!)'
It is medicine for the "Permission denied" disease that every forgotten sudo
reliably triggers and is fixed as soon as you type doch
(of course!). The shell then runs the failed command again, but preceded by sudo
. Typing sudo!!
would have the same effect, but that requires three more keystrokes and is less cool.
Properly Appended
Searching and replacing in the last entry of the Shell history helps laziness win an important battle. For example, if you typed tail /var/log/syslog
, but actually wanted to see the end of /var/log/mail
, then appending
^syslog^mail^
replaces the wrong substring. Bash runs the modified command immediately.
Ah! My "tools" list also includes calcurse
, a console-based calendar available in almost every distribution. It imports third-party calendars in the common ICS format, supports scripting, and provides information on upcoming appointments in several ways (Figure 1).
I have just found another piece of paper that says: "Change the note box to SVN." It's from 2006.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.