Daniel J. Barrett's Blog
March 7, 2024
Happy 20th anniversary, Linux Pocket Guide
The new 20th Anniversary release of Linux Pocket Guide is now available on the web and on Kindle. (The print edition arrives in stores in late March.) You might be surprised to learn that 20 years ago, this book almost didn’t get written. When I proposed the first edition to O’Reilly in 2004, they expressed disbelief about the idea. “It’s not possible to write a short book that covers Linux…
October 17, 2022
Sharpen Your Linux Command-Line Skills with Spelling Bee Puzzles
The online game Spelling Bee from the New York Times is extremely popular these days and quite addictive. Given seven letters arranged in a grid of hexagons, form as many words as you can. Each word must be four letters or longer and contain the center letter, and letters may repeat. For example, in the puzzle shown, you can form words like TACO and CHITCHAT because they contain only letters from...
April 6, 2022
Check for duplicate code with a one-liner
Duplicate lines in your code are sometimes a sign that your code needs refactoring. If a line appears very often, you might want to wrap it in a function and call the function instead, for example, making maintenance easier. Here’s a quick Linux pipeline that lists duplicate lines to help you in this task. I’ll explain it step by step. (Thanks to Robert Strandh for the basic technique.
February 21, 2022
Brace expansion to reduce typing
Have you ever found yourself copying a Linux file and adding a suffix, like this? Try this command instead, which does the same thing but with less typing (one argument instead of two): Why it works: This command employs brace expansion. A comma-separated expression like this: expands to this: In my example command, the braces enclose two strings: an empty string and a . So this expression...
February 18, 2022
Why I wrote “Efficient Linux at the Command Line”
I wrote Efficient Linux at the Command Line (2022) to help Linux users increase their productivity to get more done in less time. It covers core concepts so you understand why things work the way they do, and tips and tricks for speed. I often see Linux users working inefficiently. For example, a few years ago, I was helping a coworker learn the Python programming language on a Linux workstation.