Mastering the Terminal: My Automation Engineer’s Workflow
As we step into the new year, I want to take a moment to reflect on my journey so far. Last year brought many changes, including a smooth transition from my early interests in cybersecurity during college to my current role as an automation engineer. It’s been a rewarding shift filled with new challenges, and I’ve enjoyed diving into this dynamic field.
This blog is a space to share insights, experiences, and tips that have helped me along the way. To begin, I’ll highlight one of the most critical aspects of my daily workflow — my terminal setup, which keeps me productive and efficient in my day-to-day work.
I have a setup on my mac os, and as being from the cyber backgroudn i was much used ot be on the terminal then on the UI of the OS. But shifting to mac, made me do some changes to my terminal to make it more happening and in other words 🆒.
To start with the changes I first Installed :
Iterm :
A great utility in place of default Terminal app provided by mac even though you can choose to use the default terminal and zsh level changes would seem similar i guess. But using iterm is a personal opinion. Right of the bat it gives some customizations like split panes for multi-session views, hotkey-triggered windows for instant access, and a powerful search with regular expression support. Autocomplete, paste history, and instant replay features streamline navigation and recall. Customizability, Unix-like shortcuts, and 24-bit color support make it highly adaptable. Advanced tools like smart cursor color, global search, triggers, and automatic profile switching ensure an optimized and responsive terminal experience. With shell integration, inline image support, and even a built-in password manager, iTerm2 transforms how users interact with their terminal environment.. You can also explore some of the features from the Features Page of Iterm2.
GitHub Aliases:
Now we have the boiler plate done for our setup ! Let’s move forward with the … github part done. As an automation engineer I spend most of my time using java, selenium and github for my day to day commits, pull, push and merges. To do that using the terminal you have to type in github commands that are long sometimes and also take a lot of time to type it again and again. To solve this I added aliases for Github. in config file of github.
There are a lot of youtube videos that show great deals of aliases but I have my personal aliases and if you want for yourself you can just give these commands in you terminal ….
git config - global alias.acm '!git add . && git commit -m'
git config - global alias.acmp '!f() { git add . && git commit -m "$1" && git push; }; f'
git config - global alias.nb '!git checkout main && git pull && git checkout -b'
From these commands you will have three aliases and there functions are pretty simple…
acm -> this will simply add and do commit with a message at the end of the command
> Usage: git acm “your message here”
acmp -> this will add commit and then also push and this is fucntion which takes the first argument as commit message and making it easy for me to push my current changes while adding commiting alltogether.
>Usage: git acmp “your message here”
nb -> this will create a new branch but with a twist this will also do git pull so that the main branch is updated when you create a new branch.
>Usage: git nb “branch_name_here”
- note: you should only give a branch name that is valid in github … meaning no spaces, though you can code to replace any space with _ .
- Do it and let me know….
ZSH (Oh My ZSH!!) :
Oh My Zsh is an open-source framework that makes using Zsh more powerful and efficient. It offers autocomplete, syntax highlighting, and tons of plugins and themes to customize your terminal. With over 300 plugins for development tools and version control, it helps streamline workflows and makes the command line more interactive and visually appealing.
You can setup your Oh my ZSH and customize it according to your needs from their github repo….
Now if you want something like what I have on my zsh you have install oh my zsh and then you will have to replace your .zshrc to one like this.
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n] confirmations, etc.) must go above this block; everything else may go below this block.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
fcd(){
local dir
dir=$(find ${1:-.} -type d -not -path '*/\.*' 2> /dev/null | fzf +m) && cd "$dir"
}
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
# Path to your Oh My Zsh installation.
export ZSH="$HOME/.oh-my-zsh"
export PATH="/opt:$PATH"
# Set name of the theme to load
ZSH_THEME="powerlevel10k/powerlevel10k"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# HYPHEN_INSENSITIVE="true"
# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
# zstyle ':omz:update' mode auto # update automatically without asking
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='nvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch $(uname -m)"
# Set personal aliases, overriding those provided by Oh My Zsh libs,
# plugins, and themes. Aliases can be placed here, though Oh My Zsh
# users are encouraged to define aliases within a top-level file in
# the $ZSH_CUSTOM folder, with .zsh extension.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# To customize prompt, run p10k configure or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# export JAVA_HOME="<hidden>"
# export M2_HOME="<hidden>"
# export PATH=${M2_HOME}/bin:${PATH}
# export PATH
# mvnc function
mvnc() {
mvn clean install -P$1 -Dcucumber.filter.tags="$2"
}
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
figlet "Hello , $(whoami)!" | lolcat
neofetch
In my ~/.zshrc
file, I’ve customized various settings to optimize my terminal environment. I’ve set the theme to Powerlevel10k for a clean and visually appealing prompt, and enabled plugins like git
, zsh-autosuggestions
, and zsh-syntax-highlighting
to improve productivity with features like autocompletion and syntax highlighting. I’ve also configured environment variables such as JAVA_HOME
and M2_HOME
to manage tools and paths. One of my custom additions is the mvnc
command, which runs Maven's clean and install commands with specific profiles and tags for Cucumber tests. Figlet is used to add a custom text and giving it color using the lolcat command, after that there is neo fetch which gives a unique output whenever i open my terminal for this mac it shows the logo and basic system details in color which does look cool.
Every time I open a new terminal session, these settings are applied, giving me a streamlined and efficient workflow.
You can also config your custom nav bar using Oh my zsh. And with the line that adds plugin in the .zshrc file of mine I have added above :
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
Due to git in the plugin i am able to see what number of files are changed in the current branch and other small details. Which does make the life easier while being working for hours on some branch.
fcd(){
local dir
dir=$(find ${1:-.} -type d -not -path '*/\.*' 2> /dev/null | fzf +m) && cd "$dir"
}
This block of code in my .zshrc file is used for doing fuzzy search I experimented a little after seeing it in some youtube video. And i does feel nice to have a dynamic search option like this in my terminal.
This is how it looks in action you just have to type in the location that you have to search then after than you search for files in that particular section very easily.
Finally you have something to experiment with and also this base line setup will be productive to help you with day to day tasks.
Hit me up if you have some suggestions to do some improvements in the terminal..!