Shell Environment

Make things easier for your Shell environment. Anything you have to repeat why do it over and over again when you can simply it.

To make an alias for your current shell environment (the alias(environment variable) will be no longer be available if you close that shell)

In the command line session you enter:

$ alias aliasname=’command with options and arguments’

For example:

$ alias yumupdate=’yum update -y’

Now all you have to do is type yumupdate and it will run yum update -y

Of course this is a basic thing but an example

Make a Permanent Alias

To make a permanent Alias you have to add it to your resource files (examples are for RedHat/Centos):

$ nano $HOME/.bashrc

Then add the following to the end of the file and save:

alias yumupdate=’yum update -y’

Then you have to update your environment or log out and back in:

$ source /etc/.bashrc

To make a system wide environment variable so all users on that system can use that alias you have to make a file like in the “/etc/profile.d/” directory and add the alias there then run

$source /etc/profile.d/  #to update your current session or just log out and back in



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s