Shell

A simple Makefile 'help' command

In this article I’m going to show you how to add a make help command to your makefiles that quickly and easily shows simple documentation for your commands: To add the help command to your makefile, add a recipe like so: .PHONY: help help: # Show help for each of the Makefile recipes. @grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done Now just make sure that each of your recipes has a comment that follows the recipe name, which will be used as its documentation.
Read more

Effective Shell for Beginners

I have rebuilt my “Effective Shell” series as an online book - it’s available now on: https://effective-shell.com The whole site is built from a GitHub repo at github.com/dwmkerr/effective-shell. It is open for contributions, changes, issues and suggestions. I’ve also added a comment section to each page to get input. To keep the material as accessible as possible, I have added a new section for beginners, to help anyone who has not used a shell before.
Read more

Effective Shell Part 7: The Subtleties of Shell Commands

In this chapter, we’ll take a look at the various different types of shell commands that exist and how this can affect your work. By the end of this chapter, you might even be able to make sense of the horrifying and perfectly syntactically valid code below: which $(where $(what $(whence $(whereis who)))) Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands What Are Commands?
Read more

Effective Shell Part 6: Everything You Don't Need To Know About Job Control

Job control is a feature of most shells, which is generally not particularly intuitive to work with. However, knowing the basics can help prevent you from getting yourself into a tangle, and can from time to time make certain tasks a little easier. In this chapter, we’ll look at the main features of job control, why it can be a problematic, and some alternatives. Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands What Is Job Control?
Read more

Effective Shell Interlude: Understanding the Shell

This is the first ‘interlude’ in my Effective Shell series. These interludes give some background, history or more flavour to some of the topics. Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands This one should be high-level enough for even non-technical readers to enjoy (or at least understand!
Read more

Effective Shell 4: Move Around!

This is the fourth part of my Effective Shell series, a set of practical examples of ways to be more efficient with everyday tasks in the shell or at the command line. Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands In this article we’ll look at the key elements of navigation in the shell.
Read more

Effective Shell Part 3: Getting Help

This is the third part of my Effective Shell series - practical examples of ways to be more efficient with everyday tasks in a shell. Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands In this article I’ll show you how to quickly get help when working with tools in the shell, without disrupting your flow!
Read more

Effective Shell Part 2: Become a Clipboard Gymnast

This is the second part of my Effective Shell series, which contains practical tips for using the shell to help with every day tasks and be more efficient: Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands In this article I’ll show you how you can use the shell as an efficient tool to compliment how you use the clipboard.
Read more

Effective Shell Part 1: Navigating the Command Line

This is the first part of a series I am writing which contains practical tips for using the shell more effectively. Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands I can’t think of a better place to start than navigating the command line.
Read more

A utility to help you wait for ports to open

There are occasions where you might need to have scripts or commands which wait for TCP/IP ports to open before you continue. I’ve come across this need again and again when working with microservices, to make my life easier I’ve created a little utility called wait-port which will wait for a port to open: It’s built in Node, the project is open source, open for contributions and ready to use:
Read more