Skip to content

Instantly share code, notes, and snippets.

@dhbalaji
Created December 25, 2020 05:18
Show Gist options
  • Save dhbalaji/b0a954b66267945353106d65929868c0 to your computer and use it in GitHub Desktop.
Save dhbalaji/b0a954b66267945353106d65929868c0 to your computer and use it in GitHub Desktop.
Set multiple permanent & temporary aliases in Linux

I wrote about aliases and other linux concepts that you need to be famililar with. Aliases are used almost every day by expert programmers. But in the real world, its not easy to create an alias and let every user in your group use it. You may need a manager or VP permission to modify something in the prod boxes which could be a frustrating process in itself, remember raising tickets for someone?

Aliases can be created and removed. I called certain aliases permenent because they persist from user session to session. Whereas the temporary ones are lost.

Set permenant alias

For individual user, create an entry in ~/.bashrc

For group users or everyone on the linux OS /etc/profile.d/yourAliasFile.sh. Its important to set the extension to .sh. You need root access to perform this activity.

Set temporary rules

Lets say I switch my user to any other shared user accound and I want the same aliases to be seen here. I can load the aliases temporarily by running . aliasesFile.txt. The first dot is important.

The temporary aliases are lost once we exit from the session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment