How to avoid recording commands to history in Fish Shell

In certain situations, you may need to run commands in the shell without having them saved in the shell history. If you are using Fish Shell, which happens to be my default shell, you can accomplish this quite easily. The following steps outline how to achieve this: Start a new shell instance with the following command: fish --private This will initiate a new shell session that will not record any commands to the history....

How to Remove First/Last Characters from a Variable in a Shell Script

When working on a Bash or Fish script, there may come a time when you need to remove the first or last few characters from a string variable. While this task might seem straightforward, it can sometimes take longer than expected to figure out the correct solution. In this blog post, we’ll explore how to remove the first or last characters from a variable in a shell script. Removing the First Characters To remove the first n characters from a string variable, you can use the cut command in combination with command substitution....

Unix Shells Tutorial: An Introduction to Using Unix Shells

A shell is a command interpreter that provides users with a text-based interface to interact with the operating system. It allows you to execute operations using commands, provides advanced features like scripting, and offers optimized ways to perform tasks compared to a Graphical User Interface (GUI). Unix shells, commonly found on Linux and macOS computers, come in different variations. The most prevalent ones include Bash, Csh, Zsh, and Fish. These shells have evolved from the original Bourne Shell, commonly known as sh, developed by Steve Bourne....