Streamline Your Terminal Workflow with Bash Aliases

Last Updated on: April 1, 2023

If you’re like most developers, you probably spend a lot of time in the terminal. And if you’re using bash, you may have noticed that there are some commands you use over and over again. Why not make your life easier by setting up some bash aliases?

An alias is a way to create a shortcut for a longer command. For example, instead of typing ls -la, you can create an alias ll that will execute the same command. Setting up aliases can save you a lot of typing and make your workflow more efficient.

To create aliases, you need to edit your bash alias file, which is usually located at ~/.bash_aliases. If the file doesn’t exist, you can create it using the following command:

touch ~/.bash_aliases

Once you have the file, you can start adding aliases. Here are some examples of useful aliases you might find helpful:

alias ll='ls -la'

This alias will list all files and directories in the current directory, including hidden files.

alias c='clear'

This alias will clear the terminal screen, which can be useful if you have a lot of output on the screen and want to start fresh.

alias gs='git status'

This alias will display the current status of the git repository in the current directory.

alias rma='rm -rf node_modules && npm install'

This alias will remove the node_modules directory and install all dependencies using npm.

These are just a few examples, but you can create any alias you want based on the commands you use frequently. Just ensure the alias you create is unique and doesn’t conflict with any existing commands.

Once you’ve added your aliases to the bash alias file, you need to reload it using the following command:

source ~/.bash_aliases

Now you can use your aliases just like any other command in the terminal. For example, if you created an alias ll for ls -la, you can use it by typing ll in the terminal.

Setting up bash aliases is a simple but powerful way to save time and streamline your workflow in the terminal. By creating shortcuts for commonly used commands, you can make your life as a developer a lot easier. So why not try it and see how much time you can save?


Get notified of new posts:


Leave a Reply

Your email address will not be published. Required fields are marked *