PDA

View Full Version : [SOLVED] how to make alias permenant



wilson888888888
March 15th, 2012, 12:02 AM
i used the alias command to shorten some long commands im too lazy to type:
alias chrome='google-chrome'
but whenever i close the terminal all the aliass i made are cleared. How do i make them permanent?

jerome1232
March 15th, 2012, 12:05 AM
Put them in ~/.bash_aliases, you may need to create the file.

papibe
March 15th, 2012, 12:12 AM
Hi wilson888888888. Welcome to the forums!

Personal alias are store on the file .bashrc or .bash_aliases right in your home directory. You can also reference it like this ~/.bashrc

The regular 'ls' does not show it on the directory, as files that start with a dot are hidden from regular listing. Also nautilus (the file manager) won't show it unless you go into 'View -> Show Hidden Files' (or just press Ctrl+H).

I would advice you to first make a copy of the file (just to be extra safe):

cp .bashrc .bashrc.old
Then edit the file by doing:

gedit .bashrc
There, the best place to add your alias is right below the section that says:

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

I hope that helps, and tell us how it goes.
Regards.

wilson888888888
March 15th, 2012, 12:47 AM
i added the aliases in the .bashrc like this:
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias chrome='google-chrome'
alias earth='google-earth'
but the commands still don't work, and they don't show up in the list when I use the alias command

matt_symes
March 15th, 2012, 12:50 AM
Hi

Close the terminal and reopen it. This will re-read your ~/.bashrc file.

You can also source it, if you don't want to close the terminal.


source ~/.bashrc

Kind regards

wilson888888888
March 15th, 2012, 12:57 AM
thanks for the help! now everything works