[Show all top banners]

Comp
Replies to this thread:

More by Comp
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 UNIX help
[VIEWED 5310 TIMES]
SAVE! for ease of future access.
Posted on 02-18-12 8:29 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 
Hello everyone,

Can anyone help me to create premanent alias in UNIX? It will be a great help.

Thank you.

 
Posted on 02-18-12 11:09 PM     [Snapshot: 40]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

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

 
Posted on 02-18-12 11:37 PM     [Snapshot: 56]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 02-19-12 8:27 AM     [Snapshot: 109]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

save the alias in .cshrc file

it will create a permanet alias

 
Posted on 02-19-12 1:39 PM     [Snapshot: 205]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 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).






 
Posted on 02-19-12 3:02 PM     [Snapshot: 239]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

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 be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 30 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
ढ्याउ गर्दा दसैँको खसी गनाउच
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants
From Trump “I will revoke TPS, and deport them back to their country.”
To Sajha admin
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters