Published on September 24, 2023

Simplified Your Mundane Engineering Workflow with Aliases

Melvin Liu

By Melvin Liu

Software Design | Engineering | Architecture

4 min read

share this post

No matter how often you use the shell or terminal, sometimes you may encounter commands that are too long than necessary. Typing out such commands can become time-consuming and inefficient, especially if you regularly use the command. By harnessing the power of .bashrc (for Bash users) or .zshrc (for Zsh users) aliases to create shortcut commands for navigating the file system or managing SSH connections. In this blog post, we'll explore the benefits of using aliases and provide some practical examples to get you started.

A recent experience underscored the significance of leveraging shell aliases for streamlining daily tasks and enhancing professional efficiency. Not long ago, I found myself tasked with implementing critical changes on our staging server, with both peers and senior colleagues observing my actions. In this pivotal moment, I encountered a situation that highlighted the potential of aliases to simplify complex procedures and mitigate the risk of unintended delays.

The challenge arose when I momentarily blanked on the SSH command required to establish a connection to a specific IP server. Given the numerous SSH commands in my repertoire, this lapse was not uncommon. However, in a professional context where time is of the essence and the expectations of peers and superiors are high, such lapses can lead to unnecessary delays and even embarrassment.

Reflecting on this experience, it became evident that a proactive approach to creating and utilizing aliases within my shell configuration files could have been invaluable. These aliases, when thoughtfully defined and tailored to my workflow, could have provided quick and intuitive shortcuts for executing frequently used commands, such as SSH connections. By employing aliases, I could have seamlessly accessed the necessary server, eliminating the need to sift through a mental catalog of commands and ensuring a smoother workflow for myself and my colleagues.

What are Aliases?

Aliases are custom shortcuts or abbreviations for longer and more complex commands. They can save you time and typing effort by allowing you to execute frequently used commands with just a few keystrokes. Aliases are defined in your shell's configuration file, such as .bashrc or .zshrc, and are loaded every time you start a new terminal session.

Editing Your Configuration File

Before we dive into creating aliases, let's take a moment to ensure you know how to edit your configuration file. You can use any text editor you prefer, such as nano, vim, or gedit. Here's how you can open your .bashrc or .zshrc for editing:

For Bash users:

vim ~/.bashrc

For MacOS users:

vim ~/.zshrc

Example: Creating File System Navigation Aliases

Have you ever found yourself frequently navigating to specific directories deep within your file system? Creating aliases for these paths can save you time. For example, you can add the following aliases to your configuration file:

alias openproject='cd ~/Documents/projects/parent-project-folder/project-folder/sub-project-folder/your-targeted-folder'

Now, instead of typing cd ~/Documents/projects/parent-project-folder/project-folder/sub-project-folder/your-targeted-folder, or doing one cd at a time then type "ls" since you forgot the directory list 🫠, you can just type "openproject" or whatever short command that you can custom directly inside the .zshrc

Quick Parent Directory Navigation:

Another useful alias is one that takes you up one level in the directory hierarchy. You can add the following alias:

alias ..='cd ..'

Another example: Simplifying SSH Connections

Managing SSH connections can be made more efficient with aliases as well. Here are some examples:

  1. SSH to Remote Servers:

Do you frequently SSH into specific remote servers which you can't remember since you have more than two or three remote servers? Create aliases like this:

alias myserver='ssh user@the-ip-address'

Now, you can simply type 'myserver' to initiate an SSH connection.

  1. SCP File Transfer: Simplify file transfers with SCP using aliases:
alias scpfile='scp /path/to/destination'

Using scpfile will copy a file from your local machine to a remote server or vice versa.

Applying Changes

After adding your aliases to your .bashrc or .zshrc file, save the changes and exit your text editor. To apply these changes immediately, you can either restart your terminal or use the source command:

source ~/.bashrc  # For Bash users
source ~/.zshrc  # For Zsh users


Customizing your shell with aliases can greatly streamline your daily tasks. Whether it's simplifying file system navigation or managing SSH connections, aliases offer a convenient way to save time and reduce typing. Don't hesitate to experiment with more aliases to suit your specific needs and make your engineering workflow even more efficient. Happy engineering!