Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
07-11-2006, 08:38 AM
|
#1
|
LQ Newbie
Registered: Jul 2006
Posts: 8
Rep:
|
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.
|
|
|
07-11-2006, 08:46 AM
|
#2
|
Member
Registered: Apr 2005
Location: Havant, Hampshire, UK
Distribution: Slamd64, Slackware, PS2Linux
Posts: 465
Rep:
|
Local aliases should be placed in ~/.bashrc and global ones in /etc/bashrc
- Piete
|
|
|
07-11-2006, 08:48 AM
|
#3
|
LQ Newbie
Registered: Jul 2006
Posts: 8
Original Poster
Rep:
|
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.
|
|
|
07-11-2006, 08:54 AM
|
#4
|
Member
Registered: Apr 2005
Location: Havant, Hampshire, UK
Distribution: Slamd64, Slackware, PS2Linux
Posts: 465
Rep:
|
You should just be able to create one and have it working, bash is very easy going =)
|
|
|
07-11-2006, 08:56 AM
|
#5
|
Member
Registered: Jul 2005
Location: England, UK
Distribution: Ubuntu 8.04 Server, Kubuntu 12.04
Posts: 698
Rep:
|
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
|
|
|
07-11-2006, 08:57 AM
|
#6
|
LQ Newbie
Registered: Jul 2006
Posts: 8
Original Poster
Rep:
|
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.
|
|
|
07-11-2006, 09:02 AM
|
#7
|
LQ Newbie
Registered: Jul 2006
Posts: 8
Original Poster
Rep:
|
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.
|
|
|
07-11-2006, 09:04 AM
|
#8
|
Member
Registered: Jul 2005
Location: England, UK
Distribution: Ubuntu 8.04 Server, Kubuntu 12.04
Posts: 698
Rep:
|
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?
|
|
|
07-11-2006, 09:16 AM
|
#9
|
Member
Registered: Apr 2005
Location: Havant, Hampshire, UK
Distribution: Slamd64, Slackware, PS2Linux
Posts: 465
Rep:
|
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
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
Then, in $HOME/.bashrc make sure the following exists:
Code:
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
This will preserve your aliases when you su from user, and allow alises to crop up when you use an xterm.
I realise it's not exceptionally clear, but the explanation is long and i'm tired =)
- Piete.
|
|
|
07-11-2006, 09:18 AM
|
#10
|
LQ Newbie
Registered: Jul 2006
Posts: 8
Original Poster
Rep:
|
no bashrc, .bashrc, bash, .bash, etc...
no bashrc, .bashrc, bash, .bash, etc...
|
|
|
07-11-2006, 09:22 AM
|
#11
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
|
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.
|
|
|
07-11-2006, 09:24 AM
|
#12
|
LQ Newbie
Registered: Dec 2003
Posts: 7
Rep:
|
/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
|
|
|
07-11-2006, 09:51 AM
|
#13
|
Member
Registered: Apr 2005
Location: Havant, Hampshire, UK
Distribution: Slamd64, Slackware, PS2Linux
Posts: 465
Rep:
|
Quote:
no bashrc, .bashrc, bash, .bash, etc...
|
You can make them, there is no problem doing that. If you don't have the file ... write it.
I like sbabaro's solution to aliases - very neat, very Slackware.
|
|
|
07-11-2006, 09:59 AM
|
#14
|
LQ Newbie
Registered: Jul 2006
Posts: 8
Original Poster
Rep:
|
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.
|
|
|
07-11-2006, 10:19 AM
|
#15
|
LQ Newbie
Registered: Dec 2003
Posts: 7
Rep:
|
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 10:41 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|