Command Aliases???
Does anyone know where command aliases in SLACKWARE go? Using the alias command, aliases are gone after logout. Where do global aliases vs. user aliases placed? I would appreciate the help, thanks.
|
Local aliases should be placed in ~/.bashrc and global ones in /etc/bashrc
- Piete |
Thanks, but...
Thanks for the reply, but I don't have a .bashrc in my entire system. Is this something that I can just create, or could aliases be placed elsewhere? Thanks.
|
You should just be able to create one and have it working, bash is very easy going =)
|
If your login shell is bash you should have it in your home dir and a system one in /etc (maybe called bash.bashrc) if not loon in /etc/profile
|
I created .bashrc but...
I created the files in a few places to try it out. First, I created etc/.bashrc. Then I tried home/user/.bashrc, usr/.bashrc, and a few other places. None of them worked.
|
etc/profile
Thanks for the help. There is a file etc/profile, and I tried adding ALIAS XX="XX -X", but it didn't work. I also tried xx = "xx -x" but still didn't work.
|
in the /etc dir the file is called either /etc/bashrc (no leading dot) or /etc/bash.bashrc
What is the cpntense of your /etc/profile file? |
Ahh, I see, we still have some problems.
Basically ya gotta set up the system ... The system is as follows: /etc/profile --> $HOME/.bash_profile --> $HOME/.bashrc --> /etc/bashrc If you don't already have $HOME/.bash_profile, then create it and make sure it contains the following: Code:
# Source local bashrc Code:
# Source global definitions I realise it's not exceptionally clear, but the explanation is long and i'm tired =) - Piete. |
no bashrc, .bashrc, bash, .bash, etc...
no bashrc, .bashrc, bash, .bash, etc...
|
You probably aren't using bash. When you type at a commandline
echo $SHELL what do you see? If you are using csh or tcsh, then your shell startup script is .cshrc You can add aliases there. eg. alias dir 'ls -lash' (Note different syntax from Bourne shells.) --- rod. |
/etc/profile.d
I have aliases working with bash with an executable file that I called aliases.sh in /etc/profile.d dir
then you need to be sure that your aliases will be loaded anyway, either if your shell is a login one or not. To solve this I create .bashrc in my home [code] [ -f /etc/profile ] && . /etc/profile [ -f /etc/bashrc ] && . /etc/bashrc [\code] It executes the files in /etc/profile.d, loading also your aliases |
Quote:
I like sbabaro's solution to aliases - very neat, very Slackware. |
I'm definitely using bash
I'm using bash, but I don't have the files that people say I should have. This was a straight install of Slackware 10.2.
|
create it!
as piete said, create it!
The only files that you have in a fresh Slack is /etc/profile and /etc/profile.d (with several scripts inside) The others you need to create by yourself Use your favorite editor and write it down the file using one of the solution shown in this thread |
All times are GMT -5. The time now is 11:13 AM. |