For system, network and cloud administrators

What is a “shell”?

The Bourne Shell: /bin/sh

The shell is one of the most important parts of a Unix system and that’s why developers and admins around the world rely so much on it. It’s basically a program inside which the user can run commands and create shell scripts. Unix programmers used the shell as a programming environment too. In fact, a lot of the important parts of the Unix system itself are … shell scripts.


How to delete all Azure managed disks that start with a pattern using Azure CLI and Bash shell

In order to be able to delete all Azure managed disks that start with mydisk, for example, you’ll first need to run the Azure Bash shell instead of PowerShell and then type:

az disk list --query "[?starts_with(name,'mydisk')].[name]" | xargs -L1 bash -c 'az disk delete --resource-group yourresourcegroup --name $0 --yes'


How to delete all Azure storage accounts that start with a pattern using Azure CLI and Bash shell

In order to delete all Azure storage accounts that start with mystorage, for example, you’ll first need to run a Bash shell instead of PowerShell. Then, type:

az storage account list --query "[?starts_with(name,'mystorage')].[name]" --output tsv | xargs -L1 bash -c 'az storage account delete --name $0 --yes'


How to delete all Azure resource groups that start with a pattern using Azure CLI and Azure Bash shell

In order to delete all resource groups that start with project01, for example, you’ll first need to make sure you’re in a Bash shell and not PowerShell. Then, type:

az group list --query "[?starts_with(name,'project01')].[name]" --output tsv | xargs -L1 bash -c 'az group delete --name $0 --no-wait --yes' 


Bash completion

macOS Catalina

  1. Open your terminal and install the bash-completion package using brew:
brew install bash-completion
  1. Adjust your .bash_profile by running in your terminal:
echo "[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion" >> ~/.bash_profile
  1. Reload your .bash_profile:
source ~/.bash_profile