Exit from Bash script on error without closing the terminal window
To terminate the script in case of an error, we can use the “-e” option. When a bash script is “sourced”, called from an alias with a leading dot like my-alias='. /my-script to execute in the same process, or a function is…
Install and configure iTerm2
iTerm2 configuration Install Oh My Zsh Oh My Zsh is an open source, community-driven framework for managing your zsh configuration. More info at https://github.com/ohmyzsh/ohmyzsh Use .bashrc for configuration When you start iTerm, it reads its…
extra characters at the end of n command
When you use sed to insert a template file into another file with the command and get the error message extra characters at the end of n command Make sure the template file supplied in $1 does not have an empty line at the top.
aws: command not found
When we want to execute AWS CLI commands to create tags, add AWS keys on AWS instances with the AWS Chef cookbook, first, we need to install the AWS CLI. On Linux the following lines complete the installation Make sure you use the -b /usr/bin option to…
Remove byte-order mark from the beginning of the file
When a file is saved with BOM (byte-order mark) on a Mac or Linux machine Windows PowerShell cannot execute the script. Unfortunately the “cat” command by default does not show the byte-order mark at the beginning of the file. As Oriol stated…
Extend a Linux partition
When the Linux disk drive is full, first we need to identify the reason for the drive overuse. Many times the drive is filled with one large log file, that can be identified and truncated. To list the directory sizes under the current directory execute…
Attach an AWS EBS volume to a Linux server
Format and mount the volume List the available disk devices and their mount points The nvme1n1 volume is not yet mounted Create a partition on the volume List the existing partitions Create a new partition Check the partition list lsblk Detect the new…
Using Makefiles
Makefiles are great to self-document frequently executed commands in a repository. They provide easy access to the bash code by easy to remember tags. Formatting Only tabs are allowed to indent lines. The indentation groups the commands under the rules.…
DevOps Engineering part 1. (Ubuntu server) – Install the DevOps development tools on Ubuntu server
Ubuntu server does not have a user interface, we will use the terminal to install the DevOps tools. Terraform On your workstation open a web browser and navigate to https://www.terraform.io/downloads.html to get the version of the latest Terraform…
Using the Windows Subsystem for Linux (WSL)
Sharing files between Windows Subsystem for Linux and Windows Start WSL Access the Windows files from Linux Access the Linux files from Windows To start from Windows To start from Linux Managing packages in Linux To update the Linux packages in Ubuntu…