CLI

The Ultimate Guide to Emacs: Mastering the Art of CLI Programming

October 10, 2023

In the realm of command-line interface (CLI) programming, Emacs stands as a legendary text editor, known for its immense power and unparalleled extensibility.


Read More

The Ultimate Guide to VI: Mastering the Art of CLI Programming

October 9, 2023

In the world of command-line interface (CLI) programming, efficiency is paramount.


Read More

AWS Assume to another role

October 8, 2023

OUT=$(aws sts assume-role --role-arn arn:aws:iam::0123456789:role/OrganizationAccountAccessRole --role-session-name test) export AWS_ACCESS_KEY_ID=$(echo $OUT | cut -d '"' -f 6 ) export AWS_SECRET_ACCESS_KEY=$(echo $OUT | cut -d '"' -f 10 ) export AWS_SESSION_TOKEN=$(echo $OUT | cut -d '"' -f 14 ) aws sts get-caller-identity


Read More

How to AWS sts assume role in one command - without jq

June 9, 2023

The issue - what it takes to assume a role To assume an AWS role in the CLI, you will have to do something like this:


Read More

[Solved] Docker Daemon Connection Error: Daemon Running?

March 4, 2023

If you get the following error when trying to run a Docker container:


Read More

[Solved] M1 Docker Image Platform Mismatch with Host (ARM64)

March 3, 2023

If you get the following error when trying to run a Docker container that was built on an M1 mac:


Read More

How to Return a List of All AWS Lambda Function Names in CLI

February 24, 2023

If you would like to list all AWS Lambda Function Names in your CLI using the AWS CLI, then you can do this:


Read More

How to Install AWS SAM CLI on Mac

February 15, 2023

If you need to install AWS SAM CLI on a Mac, then the easiest option is to use Homebrew with the following commands:


Read More

How to Empty and Delete an S3 Bucket using the AWS CLI

November 9, 2022

Option 1 – Using AWS CLI Step 1 export bucketname='your-bucket-here' Step 2


Read More

How to Execute a Shell Script in NodeJS

October 25, 2022

If you need to execute a shell script in NodeJS, then you can use the exec keyword.


Read More

How to Delete all Resources Except One in Terraform

October 23, 2022

If you need to delete all resources created by Terraform, except for a single, specific one, then you can do the following:


Read More

How to Copy Files between Two Nodes using Ansible

October 22, 2022

If you need to copy files between two (2) nodes, using Ansible, then you can do the following:


Read More

How to Delete Files and Folders in a Directory using Ansible

October 21, 2022

If you need to delete files and folders in a directory using Ansible, then you can do the following:


Read More

How to Copy Multiple Files with Ansible

October 20, 2022

If you need to copy multiple files using Ansible, then you can do the following:


Read More

How to Write Multiline Shell Scripts in Ansible

October 19, 2022

If you need to write a shell script in Ansible, you probably have something like this:


Read More

How to Pass Variables to Ansible Playbook CLI

October 18, 2022

If you need to pass a variable to Ansible playbook, using the command line, then you can do the following:


Read More

How to Create a Directory using Ansible

October 17, 2022

If you need to create a directory using Ansible, then you can do the following:


Read More

How to Disable Screensaver on Mac using the CLI

October 16, 2022

If you want to disable the Screensaver on your Mac, by using the Command Line Interface (CLI), then you can do the following:


Read More

How to Copy Files from Docker Container to Host

October 8, 2022

If you need to copy files from a Docker Container to the Host, then you can do one of the following:


Read More

How to Get the IP Address of a Docker Container

October 7, 2022

If you need to get the IP Address of a Docker Container, then you can do the following:


Read More

[Solved] dial tcp: lookup proxy.golang.org: i/o timeout

September 25, 2022

If you get a timeout when trying to install go dependencies, the error may look something like this:


Read More

[Solved] fatal: Could not read from remote repository with Git

September 22, 2022

If you receive the following error when trying to clone a Git repository:


Read More

How to Install Homebrew on a Mac

September 21, 2022

Prerequisites You should have some familiarity with the Mac Terminal application since you’ll need to use it to install Homebrew.


Read More

How to create an AWS EC2 instance in CloudFormation

September 20, 2022

Create an EC2 Instance in CloudFormation If you need to create an EC2 instance in CloudFormation, then you can do the following:


Read More

How to Run Commands on an AWS ECS Cluster Task or Container

September 19, 2022

If you need to run a command, or set of commands on an AWS ECS cluster container, then you can do the following:


Read More

How to Enable ContainerInsights on AWS ECS from the AWS CLI

September 17, 2022

If you need to enable Container Insights for an ECS cluster, by using the AWS CLI, then you can do the following:


Read More

AppMesh and ECS with Imported ACM certificates on Envoy Sidecar through EFS

September 16, 2022

Summary This guide showcases the ability to use imported certificates from a third party provider (e.


Read More

How to Increase the disk size on a Cloud9 instance

September 15, 2022

If you need to increase the disk size of a Cloud9 instance, you can run the following script directly from the terminal in Cloud9:


Read More

How to Get the Instance Profile attached to an AWS EC2

September 14, 2022

If you need to get the IAM Role information from the attached EC2 role directly, you can do the following:


Read More

How to Create an AWS ECR Repository in AWS CLI

September 13, 2022

If you need to create an Elastic Container Registry (ECR) Repository from the AWS CLI, you can do the following:


Read More

How to Scale Out an AWS ECS Service

September 12, 2022

When you create the Amazon ECS service, it includes three Amazon ECS task replicas.


Read More

How to Retrieve AWS ECS Cluster Information

September 11, 2022

For more information about the Amazon ECS cluster, run the following command.


Read More

[Solved] Read timeout on endpoint URL: “https://lambda.[region].amazonaws.com/2015-03-31/functions/[function-name]/invocations”

September 9, 2022

If you get the following error: Read timeout on endpoint URL: "https://lambda.


Read More

How to Remove a Passphrase from Certificate Key

September 8, 2022

If you have a Certificate Key that includes a Passphrase and you need to remove it, potentially to use it with AWS App Mesh, then you can do the following:


Read More

How to Check if a Volume is Mounted in Bash

August 12, 2022

If you need to check if a volume is mounted in a Bash script, then you can do the following.


Read More

How to Determine if a Bash Variable is Empty

August 11, 2022

If you need to check if a bash variable is empty, or unset, then you can use the following code:


Read More

How to Order by File Size using the du command in Linux

August 10, 2022

If you use the du command to list all the file sizes on Linux:


Read More

How to Resize an AWS EBS Volume in Bash

July 27, 2022

If you need to resize an EBS volume in AWS, you can do so using bash.


Read More

How to Setup Credential Helper for AWS CodeCommit

July 25, 2022

AWS CodeCommit is a git code repository service by Amazon Web Services.


Read More

How to Approve a SageMaker model in AWS CLI

July 17, 2022

Sometimes you will need to manually approve a SageMaker model package from the AWS CLI.


Read More

How to Recursively Delete all Files in an AWS S3 Bucket

July 5, 2022

If you need to recursively delete all files in an AWS S3 bucket, then you can do the following:


Read More

How to get CPU Frequency in Linux

July 1, 2022

If you need to get the CPU Frequency in Linux, then you can run the following command:


Read More

[Solved] Instance Profile already exists in Terraform

June 26, 2022

If you get the Instance Profile already exists error when running your Terraform apply, then it is either because an instance profile with that name already existed in the account, or because the previous terraform destroy did not remove it.


Read More

How to Match Multiple Strings with grep

June 24, 2022

If you need to match a string in a file, then grep is your friend.


Read More

How to Invoke an AWS Lambda from the CLI

June 23, 2022

If you want to invoke an AWS Lambda from your CLI, then the best option is to have the AWS CLI installed.


Read More

How to Exit if a Bash Variable in Not Set

June 22, 2022

Sometimes you might want to exit a command if a variable is not set in Bash.


Read More

How to Force Gitlab pipeline to fail on condition

June 21, 2022

if you have a conditional in your Gitlab pipeline stage that checks if something has succeeded or failed, then you can use this to pass or fail your pipeline stage.


Read More

How to run AWS CLI commands based on AWS CLI Version in Bash

June 20, 2022

If you find yourself having the requirements to support both AWS CLI v1 and v2 simultaneously, then you can use the following conditional in Bash to only run the specific version required:


Read More

[Solved] Unknown options: –cli-binary-format AWS CLI

June 19, 2022

If you have tried calling the AWS CLI and got the following error:


Read More

How to Check OS version and flavor in Linux

June 17, 2022

If you need to check the version and flavour of the running Linux instance, then you can try the below commands:


Read More

[Solved] Network interface is in use by another service in AWS

June 10, 2022

If you have tried to delete a Security Group, or VPC, or various other resources and you get the dreaded Network interface is in use by another service error, then you can resolve this by deleting the resource through the API.


Read More

How to Uninstall npm packages

June 9, 2022

We typically install an npm package as follows: npm install <package_name> But how do we uninstall an npm package?


Read More

How to create a Countdown Timer in Python

June 5, 2022

If you need to count down a specific amount of time, say for example, when a token is set to expire, then a countdown timer will be useful.


Read More

How to Rename a Git Branch

May 28, 2022

If you want to rename a git branch, then you have a few options, dependent on the use-case.


Read More

[Solved] Terraform Error accessing remote module registry in PowerShell

May 23, 2022

If you are using PowerShell and trying to run a terraform init, you may get an error as follows:


Read More

How to Save sed Output Directly to a File

May 8, 2022

You have 3 options here: Option 1: use tee with sed sed 's/Hello/Hi/g' file-name | tee file Option 2: use > with sed sed 's/Hello/Hi/g' file-name > file Option 3: use sed with -i option sed -i 's/Hello/Hi/g' file-name


Read More

How to copy S3 objects between AWS accounts

April 28, 2022

In your source account create a customer-managed policy: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject" ], "Resource": [ "arn:aws:s3:::source-EXAMPLE-BUCKET", "arn:aws:s3:::source-EXAMPLE-BUCKET/*" ] }, { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:PutObject", "s3:PutObjectAcl" ], "Resource": [ "arn:aws:s3:::destination-EXAMPLE-BUCKET", "arn:aws:s3:::destination-EXAMPLE-BUCKET/*" ] } ] } In your destination bucket, update the bucket policy:


Read More

How to find all symlinks in a directory tree on Mac

April 27, 2022

If you need to recursively find all symbolic links in a directory tree on a Mac, then you have a couple of options.


Read More

How to Install App Mesh on AWS EKS

April 26, 2022

You can follow the steps below to install App Mesh on AWS EKS (Kubernetes).


Read More

[Solved] Kubernetes Namespace stuck in Terminating state

April 25, 2022

If you have tried to delete a Kubernetes namespace, and it has been hanging in ‘deleting’ for hours on end, it’s likely that you have dangling resources that have not deleted yet.


Read More

[Solved] error: src refspec main does not match any

April 23, 2022

If you get the following error: error: src refspec main does not match any error: failed to push some refs to 'https://github.


Read More

How to Force a Redeploy in Kubernetes

April 22, 2022

If you need to force a redeploy of a deployment in Kubernetes , then you can use the rollout feature.


Read More

How to Restart a Deployment in Kubernetes

April 20, 2022

If you need to restart a deployment in Kubernetes, perhaps because you would like to force a cycle of pods, then you can do the following:


Read More

How to push multiple Dockerfile apps to AWS ECR at the same time

April 19, 2022

I have a parent directory containing multiple sub-directories. Each of these child directories is a different application and contains a Dockerfile.


Read More

How to Create a Horizontal Pod Autoscaler in Kubernetes

April 18, 2022

If you could like to a create a Horizontal Pod Autoscaler (hpa) in Kubernetes, then you could run the following:


Read More

How to Run a Load Generator on Kubernetes

April 17, 2022

If you would like to test hpa, Horizontal Pod Autoscaling, or throw some chaos at a specific deployment in Kubernetes , then you could run a Load Generator


Read More

How to Deploy a Metrics Server in Kubernetes

April 16, 2022

If you would like to deploy a Metrics Server in Kubernetes , then you first need to create a namespace for it to live it, followed by installing the actual metrics server.


Read More

How to create an AWS EKS cluster using eksctl

April 15, 2022

eksctl dramatically simplifies the creation of AWS EKS clusters, by providing a simple command-line interface.


Read More

How to Dockerize a Flask App

April 14, 2022

If you have a Flask app that you would like packaged in a Docker container, then you can do the following.


Read More

How to get an EKS Cluster name from an AWS Region

April 13, 2022

You can use the aws cli to get the EKS cluster name, parse the first result and return it into a variable.


Read More

How to automatically generate a Manifests file in Kubernetes

April 12, 2022

If you want to automatically generate a manifest file in Kubernetes, you can do so by using the kubectl run command coupled with a --dry-run to output directly to yaml.


Read More

How to Sort Pods by CreationTimestamp in Kubernetes

April 11, 2022

If you need to sort a list of your pods by their CreationTimestamp, then do the following:


Read More

How to Jump onto a Kubernetes Pod with Bash

April 10, 2022

If you want to jump onto a particular Kubernetes Pod and run Bash within it, you can do so as follows:


Read More

How to run Shell Commands in a Kubernetes Cluster

April 9, 2022

If you would like to run shell commands inside of your Kubernetes cluster, then you can use the kubectl run command.


Read More

How to Bulk Move All Email from One Account to Another using the CLI

April 8, 2022

If you find yourself in a position where you need to sync all emails from one account to another, then you can use the imapsync command-line tool to bulk copy, or move everything for you.


Read More

How to Install AWS CLI on Linux

April 7, 2022

You can download and install the AWS CLI on Linux as follows:


Read More

How to Reboot Networking on Mac from CLI

April 6, 2022

If you need to reboot, or restart the networking interface on your Mac, by using the CLI, then you can issue the following commands:


Read More

[Solved] fatal: unable to access <git>: SSL certificate problem: self signed certificate in certificate chain

April 5, 2022

If you get the following error: fatal: unable to access &lt;git&gt;: SSL certificate problem: self signed certificate in certificate chain


Read More

How to Extract the Files in a Docker Image

April 4, 2022

Ever needed to extract the files in a Docker container?


Read More

[Solved] Error response from daemon: No such image: Docker

April 3, 2022

If you&rsquo;ve run into this dreaded error: Error response from daemon: No such image:


Read More

How to Update Kubectl Config from AWS EKS

April 1, 2022

Ever searched for kubectl update config from aws eks and needed a quick result?


Read More

[Solved] ZipArchive extension: disabled/not installed on Ubuntu

March 26, 2022

If you have come across the following error: ZipArchive extension:&amp;nbsp;&lt;strong&gt;disabled/not installed&lt;/strong&gt;


Read More

[Solved] error: src refspec main does not match

March 23, 2022

When you first try and push to a git repository, you may get the following error message:


Read More

How to Presign an S3 URL in AWS using AWS CLI

March 5, 2022

You can use the AWS CLI to presign URLs so that objects in S3 can be shared publicly even if they are set as private.


Read More

How to Download using Aria2c with Multiple Connections

March 4, 2022

If you use aria2c to download files using the command-line, then you can also use it to download using multiple connections.


Read More

How to Change the Timestamp of a File on Mac/Linux

February 17, 2022

If you have a file on your machine, and you want to change the created/modified time/date stamp, then you can use the touch command.


Read More

How to Boot an EC2 with a WebServer Setup

February 13, 2022

Create a new AWS EC2 instance, and set the User Script to the following:


Read More

How to get Meta-Data information from an AWS EC2 Instance

February 4, 2022

If you need to query meta-data information from your running EC2 instance, you can curl the following location:


Read More

How to Install Cuda driver for Nvidia on Ubuntu

January 4, 2022

If you have just upgraded Ubuntu on your AWS g4dn instance and need to install/reinstall Cuda drivers for your Nvidia chipset, then you can run the following:


Read More

How to List all Running Services on Ubuntu

January 3, 2022

If you need to view a list of all the services that are either running or stopped (or both) on an Ubuntu server, then you can use the following command:


Read More

How to update/upgrade all Homebrew packages

December 11, 2021

If you use Homebrew – and you probably should if you&rsquo;re on a Mac – then you have probably installed various different applications and packages as time went on.


Read More

[Solved] Error: Cannot find module ‘../lib/cli.js’

December 9, 2021

If you try and run npm i and get Error: Cannot find module '.


Read More

[Solved] Permission denied @ apply2files – /usr/local/lib/node_modules/expo-cli/node_modules/extglob/lib

December 4, 2021

If you have recently upgraded your MacOS operating system, you may get the following error in your terminal when installing some Homebrew packages:


Read More

How to set ZSH as your default Shell

November 26, 2021

You may have installed ZSH and every-time you open your terminal, it opens BASH by default.


Read More

How to Base64 Encode/Decode in the Terminal/CLI

November 25, 2021

If you need to either Encode or Decode a Base64 value, there are many ways to achieve this, one of them is directly from your commandline itself!


Read More

How to Enable Syntax Highlighting in Vim

November 24, 2021

There are a few different ways to enable Syntax Highlighting in Vim.


Read More

How to view the Encoded Authorization Failure Message in AWS

November 18, 2021

You may come across a message that reads similar to the following:


Read More

How to Generate a Random AlphNumeric String in Linux/MacOS

November 11, 2021

If you need to generate a random AlphaNumeric string from the Linux/MacOS Command-Line, then you can use the following script:


Read More

What temperature does your Mac CPU idle at?

September 10, 2021

Sometimes you will find that your Mac is running very hot, and you may want to keep track of it over time to see if it&rsquo;s persistent or only a spike.


Read More

How to Fix the ‘Bad Interpreter’ Error from AWS and Python 3.7

August 3, 2021

This error often looks something like: .zshrc: /usr/local/bin/aws: bad interpreter: /usr/local/opt/python/bin/python3.


Read More

Key-Value CLI Arguments in Python

July 29, 2021

If you have a CommandLine application (CLI) written in Python, you have a number of ways that you can take arguments from the user.


Read More

How to solve AttributeError: ‘int’ object has no attribute ‘split’ – make: [sharedmods] Error 1

July 23, 2021

If you get the following error while trying to install something via Homebrew


Read More

How to Push a Docker image to AWS ECR

July 22, 2021

By default, Docker pushes its images to Docker Hub. While Docker Hub is a great way to share both your public and private images, you may find the rest of your infrastructure on one of the prominent cloud providers.


Read More

How to Restart Sound Driver on a Mac

May 27, 2021

So for some strange reason, your audio has stopped playing through the Macbook Pro speakers, but if you plug in an external audio device, it still works?


Read More

How to tell what the CHMOD value of a file/directory is

November 21, 2020

chmod alters the permissions for a file or directory, you could allow full read/write access to a file or directory by running the following command:


Read More

How to cleanup a /var/log/journal in Linux

November 19, 2020

You may find your /var/log/journal directory taking up a lot of disk-space.


Read More

Get the total size of all the files in a directory

May 23, 2020

It&rsquo;s amazing how many times I&rsquo;ve need to find out the total size of all the files in a directory on one of our servers.


Read More

Tail and Grep: display all output but highlight search matches

April 30, 2020

I tail logs quite a lot. An example would be to tail the Apache2 access logs.


Read More

How to replace newlines with commas in CLI

April 6, 2020

If you need to replace all newline characters with a comma, or perhaps some other delimiter, then using the build-in tr utility will work very well for you.


Read More

How to remove files without a certain extension?

April 4, 2020

You have a directory with a lot of files, and you want to delete only the files that don&rsquo;t match a specific extension.


Read More

How to debug an Apache 404 error

April 3, 2020

So you are getting an error 404 or perhaps even worse, a 500!


Read More

How to Change the Timezone on Ubuntu Server

March 20, 2020

If you&rsquo;ve ever typed date into your Ubuntu Server and seen a different time or timezone appear than you expected, then it probably means that this tutorial is for you.


Read More

Learn Golang as a Python Developer

March 9, 2020

Learning Go or Golang as a Python developer, programmer or software engineer is easier than you think.


Read More

Remove Special Characters in a String using Bash

March 8, 2020

Programming languages provide the ability to remove special characters from a string quite easily.


Read More

How to Always run Python 3 from Bash

March 6, 2020

Given a directory that contains: | |- app.py |- requirements.txt |- .


Read More

How to Push Docker Images to AWS ECR

February 13, 2020

Docker images are usually stored on Docker Hub, but AWS&rsquo;s Elastic Container Registry can also be used.


Read More

How to monitor Network Traffic on Linux

February 12, 2020

There is a fantastic tool to see and monitor Bandwidth and Network Traffic on Linux.


Read More

How to use Screen on Linux

February 9, 2020

Screen on Linux is a popular command-line program that lets you multiplex between interactive shells.


Read More

How to Package a Python App using Nuitka

February 7, 2020

Learn how to package a Python app in this tutorial.


Read More

Introduction to NPM

February 6, 2020

What is NPM? NPM stands for Node Package Manager, and is the default way to extend your Node applications.


Read More

How to create a Symbolic Link on Linux / Mac

February 5, 2020

A symbolic link – or often just sym-link – is a pointer or shortcut to where the actual file lives on a filesystem.


Read More

Non-interactive git clone (ssh fingerprint prompt)

February 4, 2020

If you have ever been in the annoying situation where you had to run git clone from a server that you did not have interactive access to, such as a continuous integration/deployment box or other.


Read More

How to exit Vim

January 30, 2020

If only I had a dollar for every time I saw someone sitting at their computer, trying for the life of them to exit vim


Read More

How to Delete large amount of files in directory

December 9, 2019

So you have clearly got a very large amount of files!


Read More

How to Merge multiple files, removing duplicate values

November 25, 2019

If you have multiple files and you want to remove duplicate values from, while creating a single file.


Read More

Just SSH to my Jump Box!

September 26, 2018

I am a professional software engineer and do an absolute ton of devops work as well.


Read More

Connection broken by ‘SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)’

July 26, 2018

This happens when your machine does not have the correct certificate bundle to access the Pypi repository, or you are behind a corporate proxy that just loves to block everything!


Read More

Get the output of an application logged in the terminal

April 16, 2018

Just a quick note: You are probably looking for a Linux command called `dtrace`.


Read More