Hello everyone,
Can anyone help me to create premanent alias in UNIX? It will be a great help.
Thank you.
Do the following steps:
1. cd
2. vi .bashrc
3. alias command='aliasofcommand'
4. save and quit (:wq!)
5. exit and login again.
If this doesnot work for you then apply the same steps for .bash_profile
2. vi .bash_profile
This will create permanent alias for you.
Last edited: 18-Feb-12 11:27 PM
save the alias in .cshrc file
it will create a permanet alias
Comp,
depends on what shell you're running.
Bash is most common (comes default with ubuntu, archlinux) and for that you need to add the alias to ~/.bashrc OR a better way would be to add it to ~/.bash_aliases given that you have sourced ~/.bash_aliases from your bashrc.
Everytime you invoke the shell, bash checks the bashrc file to see what configuration defaults to start with and if you have your alias set there, then it uses that too.
So in your .bashrc or your .bash_aliases (i keep mine in aliases cuz i have a tonne of them and so makes it easier to manage) you set your alias like you would normally with
alias [your-alias-name] = "[whatever]"
Once you've saved your file, you can use the 'source' command to reload your configs like so:
source ~/.bash_aliases (or whatever file u wrote into).
Thank you Everyone for quick reponses.
I was also wondering if we can make alias without using assign operator.
I know we can make it on C shell but what about bash.
Please log in to reply to this post
You can also log in using your Facebook
What people are reading
You might like these other discussions...
· Posts 20
· Viewed 5381
· Likes 3
· Posts 21
· Viewed 3282
· Likes 1
· Posts 36
· Viewed 4331
· Likes 11